|
|
@@ -901,22 +901,23 @@ func (r *Ermcp3AreaSpotDetail) GetDataEx() (interface{}, error) {
|
|
|
|
|
|
// Ermcp3Wrstandard 现货品类
|
|
|
type Ermcp3Wrstandard struct {
|
|
|
- WRSTANDARDID int64 `json:"wrstandardid" xorm:"'WRSTANDARDID'"` // 品类ID(SEQ_WRSTANDARD)
|
|
|
- WRSTANDARDCODE string `json:"wrstandardcode" xorm:"'WRSTANDARDCODE'"` // 品类代码
|
|
|
- DELIVERYGOODSID int32 `json:"deliverygoodsid" xorm:"'DELIVERYGOODSID'"` // 现货品种ID
|
|
|
- UNITID int32 `json:"unitid" xorm:"'UNITID'"` // 品类单位ID
|
|
|
- MINIVALUE int32 `json:"minivalue" xorm:"'MINIVALUE'"` // 最小变动值
|
|
|
- MINIVALUEDP int32 `json:"minivaluedp" xorm:"'MINIVALUEDP'"` // 最小变动值小数位
|
|
|
- REALMINIVALUE int32 `json:"realminivalue" xorm:"'REALMINIVALUE'"` // 实际最小变动值
|
|
|
- REALMINIVALUEDP int32 `json:"realminivaluedp" xorm:"'REALMINIVALUEDP'"` // 实际最小变动值小数位
|
|
|
- CREATORID int64 `json:"creatorid" xorm:"'CREATORID'"` // 创建人
|
|
|
- CREATETIME string `json:"createtime" xorm:"'CREATETIME'"` // 创建时间
|
|
|
- WRSTANDARDNAME string `json:"wrstandardname" xorm:"'WRSTANDARDNAME'"` // 品类名称
|
|
|
- AREAUSERID int `json:"areauserid" xorm:"'AREAUSERID'"` // 所属机构
|
|
|
- EnumdicName string `json:"enumdicname"` // 品类单位名称
|
|
|
- ISVALID int32 `json:"isvalid" xorm:"'ISVALID'"` // 是否有效 0-无效(停用) 1-有效(正常)
|
|
|
- UPDATETIME string `json:"updatetime" xorm:"'UPDATETIME'"` // 更新时间
|
|
|
- REMARK string `json:"remark" xorm:"'REMARK'"` // 备注
|
|
|
+ WRSTANDARDID int64 `json:"wrstandardid" xorm:"'WRSTANDARDID'"` // 品类ID(SEQ_WRSTANDARD)
|
|
|
+ WRSTANDARDCODE string `json:"wrstandardcode" xorm:"'WRSTANDARDCODE'"` // 品类代码
|
|
|
+ DELIVERYGOODSID int32 `json:"deliverygoodsid" xorm:"'DELIVERYGOODSID'"` // 现货品种ID
|
|
|
+ UNITID int32 `json:"unitid" xorm:"'UNITID'"` // 品类单位ID
|
|
|
+ MINIVALUE int32 `json:"minivalue" xorm:"'MINIVALUE'"` // 最小变动值
|
|
|
+ MINIVALUEDP int32 `json:"minivaluedp" xorm:"'MINIVALUEDP'"` // 最小变动值小数位
|
|
|
+ REALMINIVALUE int32 `json:"realminivalue" xorm:"'REALMINIVALUE'"` // 实际最小变动值
|
|
|
+ REALMINIVALUEDP int32 `json:"realminivaluedp" xorm:"'REALMINIVALUEDP'"` // 实际最小变动值小数位
|
|
|
+ CREATORID int64 `json:"creatorid" xorm:"'CREATORID'"` // 创建人
|
|
|
+ CREATETIME string `json:"createtime" xorm:"'CREATETIME'"` // 创建时间
|
|
|
+ WRSTANDARDNAME string `json:"wrstandardname" xorm:"'WRSTANDARDNAME'"` // 品类名称
|
|
|
+ AREAUSERID int `json:"areauserid" xorm:"'AREAUSERID'"` // 所属机构
|
|
|
+ EnumdicName string `json:"enumdicname"` // 品类单位名称
|
|
|
+ ISVALID int32 `json:"isvalid" xorm:"'ISVALID'"` // 是否有效 0-无效(停用) 1-有效(正常)
|
|
|
+ UPDATETIME string `json:"updatetime" xorm:"'UPDATETIME'"` // 更新时间
|
|
|
+ REMARK string `json:"remark" xorm:"'REMARK'"` // 备注
|
|
|
+ CONVERTFACTOR float64 `json:"convertfactor" xorm:"'CONVERTFACTOR'"` // 标仓系数
|
|
|
}
|
|
|
|
|
|
func (r *Ermcp3Wrstandard) calc() {
|
|
|
@@ -938,6 +939,7 @@ func (r *Ermcp3Wrstandard) buildSql() string {
|
|
|
" ISVALID," +
|
|
|
" to_char(UPDATETIME, 'yyyy-mm-dd hh24:mi:ss') UPDATETIME," +
|
|
|
" REMARK," +
|
|
|
+ " CONVERTFACTOR," +
|
|
|
" AREAUSERID" +
|
|
|
" from wrstandard t" +
|
|
|
" where t.AREAUSERID=%v"
|
|
|
@@ -968,7 +970,7 @@ type Ermcp3AreaStockApply struct {
|
|
|
INOUTAPPLYID string `json:"inoutapplyid" xorm:"'INOUTAPPLYID'"` // 申请ID(607+Unix秒时间戳(10位)+xxxxxx)
|
|
|
USERID int64 `json:"userid" xorm:"'USERID'"` // 机构ID
|
|
|
INOUTTYPE int32 `json:"inouttype" xorm:"'INOUTTYPE'"` // 出入库类型 - 1:采购入库 2:销售出库 3:生产入库 4:生产出库
|
|
|
- WRSTANDARDID string `json:"wrstandardid" xorm:"'WRSTANDARDID'"` // 品类ID
|
|
|
+ WRSTANDARDID int32 `json:"wrstandardid" xorm:"'WRSTANDARDID'"` // 品类ID
|
|
|
SPOTGOODSBRANDID int32 `json:"spotgoodsbrandid" xorm:"'SPOTGOODSBRANDID'"` // 现货品牌ID
|
|
|
SPOTCONTRACTID string `json:"spotcontractid" xorm:"'SPOTCONTRACTID'"` // 关联现货合同ID
|
|
|
WAREHOUSEINFOID string `json:"warehouseinfoid" xorm:"'WAREHOUSEINFOID'"` // 现货仓库ID
|
|
|
@@ -1004,6 +1006,8 @@ type Ermcp3AreaStockApply struct {
|
|
|
DELIVERYGOODSID int32 `json:"deliverygoodsid" xorm:"'DELIVERYGOODSID'"` // 现货品种id
|
|
|
DELIVERYGOODSCODE string `json:"deliverygoodscode" xorm:"'DELIVERYGOODSCODE'"` // 现货品种代码
|
|
|
DELIVERYGOODSNAME string `json:"deliverygoodsname" xorm:"'DELIVERYGOODSNAME'"` // 现货品种名称
|
|
|
+ BUYNICKNAME string `json:"buynickname"` // 采购方昵称
|
|
|
+ SELLNICKNAME string `json:"sellnickname"` // 销售方昵称
|
|
|
|
|
|
FilterStatus string `json:"-"` // 查询条件, 申请状态, 逗号隔开
|
|
|
FilterType string `json:"-"` // 查询条件, 出入库类型, 逗号隔开
|
|
|
@@ -1013,9 +1017,9 @@ type Ermcp3AreaStockApply struct {
|
|
|
|
|
|
func (r *Ermcp3AreaStockApply) calc() {
|
|
|
// 采购方名称
|
|
|
- r.BUYUSERNAME = mtpcache.GetUserNameByUserId(r.BUYUSERID)
|
|
|
+ r.BUYUSERNAME, r.BUYNICKNAME = mtpcache.GetUserNameAndNickName(r.BUYUSERID)
|
|
|
// 销售方名称
|
|
|
- r.SELLUSERNAME = mtpcache.GetUserNameByUserId(r.SELLUSERID)
|
|
|
+ r.SELLUSERNAME, r.SELLNICKNAME = mtpcache.GetUserNameAndNickName(r.SELLUSERID)
|
|
|
// 申请人名称
|
|
|
if r.APPLYSRC == 1 {
|
|
|
r.APPLYNAME = mtpcache.GetSystemmangerLoginCode(r.APPLYID)
|
|
|
@@ -1090,7 +1094,7 @@ func (r *Ermcp3AreaStockApply) buildSql() string {
|
|
|
sqlId.And("t.DELIVERYGOODSID", r.DELIVERYGOODSID)
|
|
|
}
|
|
|
// 品类id
|
|
|
- if len(r.WRSTANDARDID) > 0 {
|
|
|
+ if r.WRSTANDARDID > 0 {
|
|
|
sqlId.And("t.WRSTANDARDID", r.WRSTANDARDID)
|
|
|
}
|
|
|
// 品牌id
|
|
|
@@ -1287,7 +1291,7 @@ func (r *Ermcp3AreaStock) GetDataEx() (interface{}, error) {
|
|
|
// Ermcp3AreaStockReport 库存报表
|
|
|
type Ermcp3AreaStockReport struct {
|
|
|
USERID int64 `json:"userid" xorm:"'USERID'"` // 机构ID
|
|
|
- WRSTANDARDID string `json:"wrstandardid" xorm:"'WRSTANDARDID'"` // 品类ID
|
|
|
+ WRSTANDARDID int32 `json:"wrstandardid" xorm:"'WRSTANDARDID'"` // 品类ID
|
|
|
SPOTGOODSBRANDID int32 `json:"spotgoodsbrandid" xorm:"'SPOTGOODSBRANDID'"` // 现货品牌ID
|
|
|
WAREHOUSEINFOID string `json:"warehouseinfoid" xorm:"'WAREHOUSEINFOID'"` // 仓库ID
|
|
|
ORISTOCK float64 `json:"oristock" xorm:"'ORISTOCK'"` // 期初库存量
|
|
|
@@ -1368,9 +1372,7 @@ func (r *Ermcp3AreaStockReport) buildSql() string {
|
|
|
// 现货商品id
|
|
|
sqlId.AndEx("t.DELIVERYGOODSID", r.DELIVERYGOODSID, r.DELIVERYGOODSID > 0)
|
|
|
// 品类id
|
|
|
- if len(r.WRSTANDARDID) > 0 {
|
|
|
- sqlId.And("t.WRSTANDARDID", r.WRSTANDARDID)
|
|
|
- }
|
|
|
+ sqlId.AndEx("t.WRSTANDARDID", r.WRSTANDARDID, r.WRSTANDARDID > 0)
|
|
|
// 品牌id
|
|
|
if r.SPOTGOODSBRANDID > 0 {
|
|
|
sqlId.And("t.SPOTGOODSBRANDID", r.SPOTGOODSBRANDID)
|
|
|
@@ -1393,3 +1395,162 @@ func (r *Ermcp3AreaStockReport) GetDataEx() (interface{}, error) {
|
|
|
}
|
|
|
return sData, err
|
|
|
}
|
|
|
+
|
|
|
+// Ermcp3SpotGoodsPrice 现货市价
|
|
|
+type Ermcp3SpotGoodsPrice struct {
|
|
|
+ WRSTANDARDID int64 `json:"wrstandardid" xorm:"'WRSTANDARDID'"` // 现货品类ID(通用则为0)
|
|
|
+ SPOTGOODSBRANDID int32 `json:"spotgoodsbrandid" xorm:"'SPOTGOODSBRANDID'"` // 现货品牌ID(通用则为0, 不为0则须先有品类ID)
|
|
|
+ CURRENCYID int64 `json:"currencyid" xorm:"'CURRENCYID'"` // 报价货币ID
|
|
|
+ SPOTGOODSPRICE float64 `json:"spotgoodsprice" xorm:"'SPOTGOODSPRICE'"` // 现货价格
|
|
|
+ TRADEDATE string `json:"tradedate" xorm:"'TRADEDATE'"` // 交易日(yyyyMMdd)
|
|
|
+ OPERATESRC int32 `json:"operatesrc" xorm:"'OPERATESRC'"` // 最后操作来源 - 1:管理端 2:终端
|
|
|
+ OPERATEID int64 `json:"operateid" xorm:"'OPERATEID'"` // 最后操作人
|
|
|
+ OPERATETIME string `json:"operatetime" xorm:"'OPERATETIME'"` // 最后操作时间
|
|
|
+ ISVALID int32 `json:"isvalid" xorm:"'ISVALID'"` // 是否有效 - 0:无效 1:有效
|
|
|
+ AREAUSERID int64 `json:"areauserid" xorm:"'AREAUSERID'"` // 所属机构id
|
|
|
+ WRSTANDARDCODE string `json:"wrstandardcode" xorm:"'WRSTANDARDCODE'"` // 品类代码
|
|
|
+ WRSTANDARDNAME string `json:"wrstandardname" xorm:"'WRSTANDARDNAME'"` // 品类名称
|
|
|
+ UNITID int32 `json:"unitid" xorm:"'UNITID'"` // 现货商品单位id
|
|
|
+ BRANDNAME string `json:"brandname" xorm:"'BRANDNAME'"` // 品牌名称
|
|
|
+ GMUNITID int32 `json:"gmunitid" xorm:"'GMUNITID'"` // 品类单位id
|
|
|
+ DELIVERYGOODSID int32 `json:"deliverygoodsid" xorm:"'DELIVERYGOODSID'"` // 现货商品id
|
|
|
+ DELIVERYGOODSCODE string `json:"deliverygoodscode" xorm:"'DELIVERYGOODSCODE'"` // 现货商品代码
|
|
|
+ DELIVERYGOODSNAME string `json:"deliverygoodsname" xorm:"'DELIVERYGOODSNAME'"` // 现货商品名称
|
|
|
+
|
|
|
+ OPERATORNAME string `json:"operatorname"` // 操作人名称
|
|
|
+ ENUMDICNAME string `json:"enumdicname"` // 现货商品单位名称
|
|
|
+ GBENUMDICNAME string `json:"gbenumdicname"` // 品类单位名称
|
|
|
+}
|
|
|
+
|
|
|
+func (r *Ermcp3SpotGoodsPrice) calc() {
|
|
|
+ if r.OPERATESRC == 1 {
|
|
|
+ r.OPERATORNAME = mtpcache.GetSystemmangerLoginCode(r.OPERATEID)
|
|
|
+ } else {
|
|
|
+ r.OPERATORNAME = mtpcache.GetLoginCodeByLoginId(r.OPERATEID)
|
|
|
+ }
|
|
|
+ r.ENUMDICNAME = mtpcache.GetEnumDicitemName(r.UNITID)
|
|
|
+ r.GBENUMDICNAME = mtpcache.GetEnumDicitemName(r.GMUNITID)
|
|
|
+}
|
|
|
+
|
|
|
+func (r *Ermcp3SpotGoodsPrice) buildSql() string {
|
|
|
+ var sqlId utils.SQLVal = "SELECT t.WRSTANDARDID," +
|
|
|
+ " t.SPOTGOODSBRANDID," +
|
|
|
+ " t.CURRENCYID," +
|
|
|
+ " t.SPOTGOODSPRICE," +
|
|
|
+ " t.TRADEDATE," +
|
|
|
+ " t.OPERATESRC," +
|
|
|
+ " t.OPERATEID," +
|
|
|
+ " to_char(t.OPERATETIME, 'yyyy-mm-dd hh24:mi:ss') OPERATETIME," +
|
|
|
+ " t.ISVALID," +
|
|
|
+ " w.areauserid," +
|
|
|
+ " w.wrstandardcode," +
|
|
|
+ " w.wrstandardname," +
|
|
|
+ " w.unitid gmunitid," +
|
|
|
+ " gb.dgfactoryitemvalue brandname," +
|
|
|
+ " g.deliverygoodsid," +
|
|
|
+ " g.deliverygoodscode," +
|
|
|
+ " g.deliverygoodsname," +
|
|
|
+ " g.goodsunitid unitid" +
|
|
|
+ " FROM ERMCP_SPOTGOODSPRICE t" +
|
|
|
+ " left join wrstandard w" +
|
|
|
+ " on t.wrstandardid = w.wrstandardid" +
|
|
|
+ " left join dgfactoryitem gb" +
|
|
|
+ " on t.spotgoodsbrandid = gb.dgfactoryitemid" +
|
|
|
+ " left join deliverygoods g" +
|
|
|
+ " on t.deliverygoodsid = g.deliverygoodsid" +
|
|
|
+ " WHERE 1 = 1"
|
|
|
+ sqlId.And("w.areauserid", r.AREAUSERID)
|
|
|
+ return sqlId.String()
|
|
|
+}
|
|
|
+
|
|
|
+// GetDataEx 获取现货市价
|
|
|
+func (r *Ermcp3SpotGoodsPrice) GetDataEx() (interface{}, error) {
|
|
|
+ sData := make([]Ermcp3SpotGoodsPrice, 0)
|
|
|
+ err := db.GetEngine().SQL(r.buildSql()).Find(&sData)
|
|
|
+ if err == nil {
|
|
|
+ for i := range sData {
|
|
|
+ sData[i].calc()
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return sData, err
|
|
|
+}
|
|
|
+
|
|
|
+// Ermcp3SpotGoodsPriceLog 现货市价操作日志
|
|
|
+type Ermcp3SpotGoodsPriceLog struct {
|
|
|
+ LOGID int64 `json:"logid" xorm:"'LOGID'"` // 日志id
|
|
|
+ WRSTANDARDID int64 `json:"wrstandardid" xorm:"'WRSTANDARDID'"` // 现货品类ID(通用则为0)
|
|
|
+ SPOTGOODSBRANDID int32 `json:"spotgoodsbrandid" xorm:"'SPOTGOODSBRANDID'"` // 现货品牌ID(通用则为0, 不为0则须先有品类ID)
|
|
|
+ CURRENCYID int64 `json:"currencyid" xorm:"'CURRENCYID'"` // 报价货币ID
|
|
|
+ SPOTGOODSPRICE float64 `json:"spotgoodsprice" xorm:"'SPOTGOODSPRICE'"` // 现货价格
|
|
|
+ TRADEDATE string `json:"tradedate" xorm:"'TRADEDATE'"` // 交易日(yyyyMMdd)
|
|
|
+ OPERATESRC int32 `json:"operatesrc" xorm:"'OPERATESRC'"` // 最后操作来源 - 1:管理端 2:终端
|
|
|
+ OPERATEID int64 `json:"operateid" xorm:"'OPERATEID'"` // 最后操作人
|
|
|
+ OPERATETIME string `json:"operatetime" xorm:"'OPERATETIME'"` // 最后操作时间
|
|
|
+ AREAUSERID int64 `json:"areauserid" xorm:"'AREAUSERID'"` // 所属机构id
|
|
|
+ WRSTANDARDCODE string `json:"wrstandardcode" xorm:"'WRSTANDARDCODE'"` // 品类代码
|
|
|
+ WRSTANDARDNAME string `json:"wrstandardname" xorm:"'WRSTANDARDNAME'"` // 品类名称
|
|
|
+ UNITID int32 `json:"unitid" xorm:"'UNITID'"` // 现货商品单位id
|
|
|
+ BRANDNAME string `json:"brandname" xorm:"'BRANDNAME'"` // 品牌名称
|
|
|
+ GMUNITID int32 `json:"gmunitid" xorm:"'GMUNITID'"` // 品类单位id
|
|
|
+ DELIVERYGOODSID int32 `json:"deliverygoodsid" xorm:"'DELIVERYGOODSID'"` // 现货商品id
|
|
|
+ DELIVERYGOODSCODE string `json:"deliverygoodscode" xorm:"'DELIVERYGOODSCODE'"` // 现货商品代码
|
|
|
+ DELIVERYGOODSNAME string `json:"deliverygoodsname" xorm:"'DELIVERYGOODSNAME'"` // 现货商品名称
|
|
|
+
|
|
|
+ OPERATORNAME string `json:"operatorname"` // 操作人名称
|
|
|
+ ENUMDICNAME string `json:"enumdicname"` // 现货商品单位名称
|
|
|
+ GBENUMDICNAME string `json:"gbenumdicname"` // 品类单位名称
|
|
|
+}
|
|
|
+
|
|
|
+func (r *Ermcp3SpotGoodsPriceLog) calc() {
|
|
|
+ if r.OPERATESRC == 1 {
|
|
|
+ r.OPERATORNAME = mtpcache.GetSystemmangerLoginCode(r.OPERATEID)
|
|
|
+ } else {
|
|
|
+ r.OPERATORNAME = mtpcache.GetLoginCodeByLoginId(r.OPERATEID)
|
|
|
+ }
|
|
|
+ r.ENUMDICNAME = mtpcache.GetEnumDicitemName(r.UNITID)
|
|
|
+ r.GBENUMDICNAME = mtpcache.GetEnumDicitemName(r.GMUNITID)
|
|
|
+}
|
|
|
+
|
|
|
+func (r *Ermcp3SpotGoodsPriceLog) buildSql() string {
|
|
|
+ var sqlId utils.SQLVal = "SELECT t.WRSTANDARDID," +
|
|
|
+ " t.SPOTGOODSBRANDID," +
|
|
|
+ " t.CURRENCYID," +
|
|
|
+ " t.SPOTGOODSPRICE," +
|
|
|
+ " t.TRADEDATE," +
|
|
|
+ " t.OPERATESRC," +
|
|
|
+ " t.OPERATEID," +
|
|
|
+ " to_char(t.OPERATETIME, 'yyyy-mm-dd hh24:mi:ss') OPERATETIME," +
|
|
|
+ " t.LOGID," +
|
|
|
+ " w.areauserid," +
|
|
|
+ " w.wrstandardcode," +
|
|
|
+ " w.wrstandardname," +
|
|
|
+ " w.unitid gmunitid," +
|
|
|
+ " gb.dgfactoryitemvalue brandname," +
|
|
|
+ " g.goodsunitid unitid ," +
|
|
|
+ " g.deliverygoodsid," +
|
|
|
+ " g.deliverygoodscode," +
|
|
|
+ " g.deliverygoodsname" +
|
|
|
+ " FROM ERMCP_SPOTGOODSPRICELOG t" +
|
|
|
+ " left join wrstandard w" +
|
|
|
+ " on t.wrstandardid = w.wrstandardid" +
|
|
|
+ " left join dgfactoryitem gb" +
|
|
|
+ " on t.spotgoodsbrandid = gb.dgfactoryitemid" +
|
|
|
+ " left join deliverygoods g" +
|
|
|
+ " on t.deliverygoodsid = g.deliverygoodsid" +
|
|
|
+ " WHERE 1 = 1"
|
|
|
+ sqlId.And("w.areauserid", r.AREAUSERID)
|
|
|
+ sqlId.And("t.deliverygoodsid", r.DELIVERYGOODSID)
|
|
|
+ return sqlId.String()
|
|
|
+}
|
|
|
+
|
|
|
+// GetDataEx 获取现货市价信息日志
|
|
|
+func (r *Ermcp3SpotGoodsPriceLog) GetDataEx() (interface{}, error) {
|
|
|
+ sData := make([]Ermcp3SpotGoodsPrice, 0)
|
|
|
+ err := db.GetEngine().SQL(r.buildSql()).Find(&sData)
|
|
|
+ if err == nil {
|
|
|
+ for i := range sData {
|
|
|
+ sData[i].calc()
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return sData, err
|
|
|
+}
|