|
@@ -1109,10 +1109,10 @@ namespace JLHHJSvr.Helper
|
|
|
DbSqlHelper.SelectOne(cmd, mattress, fields);
|
|
|
return mattress;
|
|
|
}
|
|
|
- public List<u_mattress_mx_mtrl> GetMattressMxMtrl(int mattressid)
|
|
|
+ public List<u_mattress_mx_mtrl> GetMattressMxMtrl(int mattressid,List<string> extraWhere = null)
|
|
|
{
|
|
|
var mxList = new List<u_mattress_mx_mtrl>();
|
|
|
- var outputFields = @"mattressmxid,mattressid,formulaid,formula,mtrlid,price,gram_weight,cloth_width,if_inputqty,qty,costamt,if_15strip,if_success,shrinkage,replace_formula,priceunit,if_areaprice,thickness,chastr,dv_dscrp,xu,useqty,useformula,replace_useformula,gydscrp,cw_erpmtrlcode,erp_mtrlid";
|
|
|
+ var outputFields = @"mattressmxid,mattressid,formulaid,formula,mtrlid,price,gram_weight,cloth_width,if_inputqty,qty,costamt,if_15strip,if_success,shrinkage,replace_formula,priceunit,if_areaprice,thickness,chastr,dv_dscrp,xu,useqty,useformula,replace_useformula,gydscrp,cw_erpmtrlcode,erp_mtrlid,formulakind,formulatype,mtrlname";
|
|
|
var selectStr = @"SELECT u_mattress_mx_mtrl.mattressmxid
|
|
|
,u_mattress_mx_mtrl.mattressid
|
|
|
,u_mattress_mx_mtrl.formulaid
|
|
@@ -1140,8 +1140,22 @@ namespace JLHHJSvr.Helper
|
|
|
,u_mattress_mx_mtrl.gydscrp
|
|
|
,u_mattress_mx_mtrl.cw_erpmtrlcode
|
|
|
,u_mattress_mx_mtrl.erp_mtrlid
|
|
|
- FROM u_mattress_mx_mtrl";
|
|
|
- DbSqlHelper.SelectJoin(cmd, selectStr, "u_mattress_mx_mtrl.mattressid = @mattressid", new Dictionary<string, object>() { { "@mattressid", mattressid } }, "mattressmxid", outputFields, 0, 0, mxList);
|
|
|
+ ,u_mattress_formula.formulakind
|
|
|
+ ,u_mattress_formula.formulatype
|
|
|
+ ,u_mtrl_price.name AS mtrlname
|
|
|
+ FROM u_mattress_mx_mtrl
|
|
|
+ LEFT OUTER JOIN u_mattress_formula ON u_mattress_formula.formulaid = u_mattress_mx_mtrl.formulaid
|
|
|
+ LEFT OUTER JOIN u_mtrl_price ON u_mattress_mx_mtrl.mtrlid = u_mtrl_price.mtrlid";
|
|
|
+
|
|
|
+ var whereList = new List<string>();
|
|
|
+ whereList.Add("u_mattress_mx_mtrl.mattressid = @mattressid");
|
|
|
+
|
|
|
+ if(extraWhere != null && extraWhere.Any())
|
|
|
+ {
|
|
|
+ whereList = whereList.Concat(extraWhere).ToList();
|
|
|
+ }
|
|
|
+
|
|
|
+ DbSqlHelper.SelectJoin(cmd, selectStr, ListEx.GetWhereStr(whereList), new Dictionary<string, object>() { { "@mattressid", mattressid } }, "mattressmxid", outputFields, 0, 0, mxList);
|
|
|
|
|
|
return mxList;
|
|
|
}
|
|
@@ -1327,6 +1341,199 @@ namespace JLHHJSvr.Helper
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ public void SaveMattressInterface(int mattressid, List<u_mattress_interface> mxlist,List<u_mattress_interface_qd> qdlist)
|
|
|
+ {
|
|
|
+ cmd.CommandText = @"DELETE u_mattress_interface WHERE mattressid = @mattressid";
|
|
|
+ cmd.Parameters.Clear();
|
|
|
+ cmd.Parameters.AddWithValue("@mattressid", mattressid);
|
|
|
+ cmd.ExecuteNonQuery();
|
|
|
+
|
|
|
+ cmd.CommandText = @"DELETE u_mattress_interface_qd WHERE mattressid = @mattressid";
|
|
|
+ cmd.Parameters.Clear();
|
|
|
+ cmd.Parameters.AddWithValue("@mattressid", mattressid);
|
|
|
+ cmd.ExecuteNonQuery();
|
|
|
+
|
|
|
+ foreach (var mx in mxlist) {
|
|
|
+ mx.mattressid = mattressid;
|
|
|
+ DbSqlHelper.Insert(cmd, mx, "mattressid,printid,itemname,bj_pzname,bj_namemx,actual_size,sb_craft,actual_size_sb,erp_pzid,bj_inputtype,ss_rate,ls_rate");
|
|
|
+ }
|
|
|
+
|
|
|
+ foreach (var mx in qdlist)
|
|
|
+ {
|
|
|
+ mx.mattressid = mattressid;
|
|
|
+ DbSqlHelper.Insert(cmd, mx, "mattressid,printid,itemname,bj_pzname,bj_pzname_mx,bj_pzname_mx_mx,mtrlid,erp_mtrlid,wrkgrpid,useqty,dscrp,actual_useqty,qd_actual_size,qd_pfgroupqty,ss_rate,ls_rate,sh_rate");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ #region 床垫接口相关方法
|
|
|
+ /// <summary>
|
|
|
+ /// 业务审核
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="mattressid"></param>
|
|
|
+ /// <exception cref="LJCommonException"></exception>
|
|
|
+ public void MattressYWAudit(int mattressid)
|
|
|
+ {
|
|
|
+ var mattress = new u_mattress() { mattressid = mattressid };
|
|
|
+ DbSqlHelper.SelectOne(cmd, mattress, "yw_flag");
|
|
|
+
|
|
|
+ if(mattress.yw_flag == 1)
|
|
|
+ {
|
|
|
+ throw new LJCommonException("床垫已业务审核,不能业务审核!");
|
|
|
+ }
|
|
|
+
|
|
|
+ mattress.yw_flag = 1;
|
|
|
+ mattress.yw_auditingdate = context.opdate;
|
|
|
+ mattress.yw_auditingrep = context.tokendata.username;
|
|
|
+
|
|
|
+ DbSqlHelper.Update(cmd, mattress, "yw_flag,yw_auditingdate,yw_auditingrep");
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 业务撤审
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="mattressid"></param>
|
|
|
+ /// <exception cref="LJCommonException"></exception>
|
|
|
+ public void MattressYWCancelAudit(int mattressid)
|
|
|
+ {
|
|
|
+ var mattress = new u_mattress() { mattressid = mattressid };
|
|
|
+ DbSqlHelper.SelectOne(cmd, mattress, "yw_flag,js1_flag");
|
|
|
+
|
|
|
+ if (mattress.js1_flag == 1)
|
|
|
+ {
|
|
|
+ throw new LJCommonException("床垫已技术1审核,不能业务撤审!");
|
|
|
+ }
|
|
|
+
|
|
|
+ if (mattress.yw_flag == 0)
|
|
|
+ {
|
|
|
+ throw new LJCommonException("床垫未业务审核,不能业务撤审!");
|
|
|
+ }
|
|
|
+
|
|
|
+ mattress.yw_flag = 0;
|
|
|
+ mattress.yw_auditingdate = null;
|
|
|
+ mattress.yw_auditingrep = string.Empty;
|
|
|
+
|
|
|
+ DbSqlHelper.Update(cmd, mattress, "yw_flag,yw_auditingdate,yw_auditingrep");
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 产品补充审核
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="mattressid"></param>
|
|
|
+ /// <exception cref="LJCommonException"></exception>
|
|
|
+ public void MattressJSAudit(int mattressid)
|
|
|
+ {
|
|
|
+ var mattress = new u_mattress() { mattressid = mattressid };
|
|
|
+ DbSqlHelper.SelectOne(cmd, mattress, "yw_flag,js1_flag");
|
|
|
+
|
|
|
+ if (mattress.js1_flag == 1)
|
|
|
+ {
|
|
|
+ throw new LJCommonException("床垫已技术1审核,不能技术1审核!");
|
|
|
+ }
|
|
|
+
|
|
|
+ if (mattress.yw_flag == 0)
|
|
|
+ {
|
|
|
+ throw new LJCommonException("床垫未业务审核,不能技术1审核!");
|
|
|
+ }
|
|
|
+
|
|
|
+ mattress.js1_flag = 1;
|
|
|
+ mattress.js1_auditingdate = context.opdate;
|
|
|
+ mattress.js1_auditingrep = context.tokendata.username;
|
|
|
+
|
|
|
+ DbSqlHelper.Update(cmd, mattress, "js1_flag,js1_auditingdate,js1_auditingrep");
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 产品补充撤审
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="mattressid"></param>
|
|
|
+ /// <exception cref="LJCommonException"></exception>
|
|
|
+ public void MattressJSCancelAudit(int mattressid)
|
|
|
+ {
|
|
|
+ var mattress = new u_mattress() { mattressid = mattressid };
|
|
|
+ DbSqlHelper.SelectOne(cmd, mattress, "yw_flag,js1_flag,creatmtrl_flag");
|
|
|
+
|
|
|
+ if (mattress.creatmtrl_flag == 1)
|
|
|
+ {
|
|
|
+ throw new LJCommonException("床垫已生成产品,不能技术1撤审!");
|
|
|
+ }
|
|
|
+
|
|
|
+ if (mattress.js1_flag == 0)
|
|
|
+ {
|
|
|
+ throw new LJCommonException("床垫未技术1撤审,不能技术1撤审!");
|
|
|
+ }
|
|
|
+
|
|
|
+ mattress.js1_flag = 0;
|
|
|
+ mattress.js1_auditingdate = null;
|
|
|
+ mattress.js1_auditingrep = string.Empty;
|
|
|
+
|
|
|
+ DbSqlHelper.Update(cmd, mattress, "js1_flag,js1_auditingdate,js1_auditingrep");
|
|
|
+ }
|
|
|
+ /// <summary>
|
|
|
+ /// 清单补充审核
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="mattressid"></param>
|
|
|
+ /// <exception cref="LJCommonException"></exception>
|
|
|
+ public void MattressJS2Audit(int mattressid)
|
|
|
+ {
|
|
|
+ var mattress = new u_mattress() { mattressid = mattressid };
|
|
|
+ DbSqlHelper.SelectOne(cmd, mattress, "js2_flag");
|
|
|
+
|
|
|
+ if (mattress.js2_flag == 1)
|
|
|
+ {
|
|
|
+ throw new LJCommonException("床垫已技术2审核,不能技术2审核!");
|
|
|
+ }
|
|
|
+
|
|
|
+ mattress.js2_flag = 1;
|
|
|
+ mattress.js2_auditingdate = context.opdate;
|
|
|
+ mattress.js2_auditingrep = context.tokendata.username;
|
|
|
+
|
|
|
+ DbSqlHelper.Update(cmd, mattress, "js2_flag,js2_auditingdate,js2_auditingrep");
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 清单补充撤审
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="mattressid"></param>
|
|
|
+ /// <exception cref="LJCommonException"></exception>
|
|
|
+ public void MattressJS2CancelAudit(int mattressid)
|
|
|
+ {
|
|
|
+ var mattress = new u_mattress() { mattressid = mattressid };
|
|
|
+ DbSqlHelper.SelectOne(cmd, mattress, "js2_flag");
|
|
|
+
|
|
|
+ if (mattress.js2_flag == 0)
|
|
|
+ {
|
|
|
+ throw new LJCommonException("床垫未技术2审核,不能技术2撤审!");
|
|
|
+ }
|
|
|
+
|
|
|
+ mattress.js2_flag = 0;
|
|
|
+ mattress.js2_auditingdate = null;
|
|
|
+ mattress.js2_auditingrep = string.Empty;
|
|
|
+
|
|
|
+ DbSqlHelper.Update(cmd, mattress, "js2_flag,js2_auditingdate,js2_auditingrep");
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 配对ERP成品
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="mattress"></param>
|
|
|
+ /// <param name="mxlist"></param>
|
|
|
+ /// <exception cref="LJCommonException"></exception>
|
|
|
+ public void MatchERPMtrldef(u_mattress mattress,List<u_mattress_mx_mtrl> mxlist)
|
|
|
+ {
|
|
|
+ if(mattress.mattressid <= 0)
|
|
|
+ {
|
|
|
+ throw new LJCommonException("床垫id有误,请检查!");
|
|
|
+ }
|
|
|
+
|
|
|
+ DbSqlHelper.Update(cmd, mattress, "erp_mtrlid,erp_mtrlcode");
|
|
|
+
|
|
|
+ foreach(var mx in mxlist)
|
|
|
+ {
|
|
|
+ DbSqlHelper.Update(cmd, mx, "erp_mtrlid");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ #endregion
|
|
|
+
|
|
|
#region 公式计算通用方法
|
|
|
private void AddKeyValue(string key, object value, bool isReplace = true)
|
|
|
{
|