|
|
@@ -2352,3 +2352,77 @@ func (r *WrScfContractInterest) GetDataEx() (interface{}, error) {
|
|
|
}
|
|
|
return sData, err
|
|
|
}
|
|
|
+
|
|
|
+// WrOutInApply 出入库申请(提货)
|
|
|
+type WrOutInApply struct {
|
|
|
+ APPLYID string `json:"applyid" xorm:"'APPLYID'"` // 申请单id
|
|
|
+ APPLYTYPE int32 `json:"applytype" xorm:"'APPLYTYPE'"` // 申请类型 - 1:预约入库 2:预约出库 3:入库注册 4:出库注销
|
|
|
+ USERID int64 `json:"userid" xorm:"'USERID'" form:"userid"` // 用户id
|
|
|
+ APPLYTIME string `json:"applytime" xorm:"'APPLYTIME'"` // 申请时间
|
|
|
+ APPLYSTATUS int32 `json:"applystatus" xorm:"'APPLYSTATUS'"` // 申请状态 - 1:待初审 2:初审通过 3:初审拒绝 4:初审失败 5复审通过 6:复审拒绝 7:复审失败 8:已撤销
|
|
|
+ QTY int64 `json:"qty" xorm:"'QTY'"` // 数量
|
|
|
+ EXPRESSNUM string `json:"expressnum" xorm:"'EXPRESSNUM'"` // 物流单号
|
|
|
+ EXPRESSCOMPANY string `json:"expresscompany" xorm:"'EXPRESSCOMPANY'"` // 物流公司
|
|
|
+ Wr2FactorType `xorm:"extends"`
|
|
|
+}
|
|
|
+
|
|
|
+func (r *WrOutInApply) calc() {
|
|
|
+ r.Wr2FactorType.Calc()
|
|
|
+}
|
|
|
+
|
|
|
+func (r *WrOutInApply) buildSql() string {
|
|
|
+ var sqlId utils.SQLVal = "with tmp as" +
|
|
|
+ " (select to_char(t.wrfactortypeid) wrfactortypeid," +
|
|
|
+ " t.wrfactortypename2 wrfactortypename," +
|
|
|
+ " t.wrstandardid," +
|
|
|
+ " t.deliverygoodsid," +
|
|
|
+ " g.deliverygoodscode," +
|
|
|
+ " g.deliverygoodsname," +
|
|
|
+ " w.wrstandardcode," +
|
|
|
+ " w.wrstandardname," +
|
|
|
+ " w.minivalue," +
|
|
|
+ " h.warehousecode," +
|
|
|
+ " h.warehousename," +
|
|
|
+ " e.enumdicname," +
|
|
|
+ " w.wrstandardname || t.wrfactortypename2 as wrtypename" +
|
|
|
+ " from wrfactortype t" +
|
|
|
+ " left join deliverygoods g" +
|
|
|
+ " on t.deliverygoodsid = g.deliverygoodsid" +
|
|
|
+ " left join wrstandard w" +
|
|
|
+ " on t.wrstandardid = w.wrstandardid" +
|
|
|
+ " left join warehouseinfo h" +
|
|
|
+ " on t.warehouseid = h.autoid" +
|
|
|
+ " left join enumdicitem e" +
|
|
|
+ " on w.unitid = e.enumitemname" +
|
|
|
+ " and e.enumdiccode = 'goodsunit')" +
|
|
|
+ "select to_char(t.applyid) applyid," +
|
|
|
+ " t.applytype," +
|
|
|
+ " t.userid," +
|
|
|
+ " to_char(t.applytime, 'yyyy-mm-dd hh24:mi:ss') applytime," +
|
|
|
+ " decode(t.applytype, 2, t.applystatus, 4, t.applystatus2) applystatus," +
|
|
|
+ " decode(t.applytype, 2, t.inqty, 4, t.inrealqty) qty," +
|
|
|
+ " d.wrfactortypeid," +
|
|
|
+ " e.expressnum," +
|
|
|
+ " e.expresscompany," +
|
|
|
+ " k.*" +
|
|
|
+ " from WROutInApply t" +
|
|
|
+ " left join wroutindetail d" +
|
|
|
+ " on t.applyid = d.applyid" +
|
|
|
+ " left join wroutinexpress e" +
|
|
|
+ " on t.applyid = e.applyid" +
|
|
|
+ " left join tmp k" +
|
|
|
+ " on d.wrfactortypeid = k.wrfactortypeid" +
|
|
|
+ " where t.applytype in (2, 4)"
|
|
|
+ sqlId.AndEx("t.USERID", r.USERID, r.USERID > 0)
|
|
|
+ return sqlId.String()
|
|
|
+}
|
|
|
+
|
|
|
+// GetDataEx 获取出入库申请(提货)
|
|
|
+func (r *WrOutInApply) GetDataEx() (interface{}, error) {
|
|
|
+ sData := make([]WrOutInApply, 0)
|
|
|
+ err := db.GetEngine().SQL(r.buildSql()).Find(&sData)
|
|
|
+ for i := range sData {
|
|
|
+ sData[i].calc()
|
|
|
+ }
|
|
|
+ return sData, err
|
|
|
+}
|