From 777eb41b54602375bf6e7a0f26207f5fbaf27031 Mon Sep 17 00:00:00 2001
From: yl <ykxkd@outlook.com>
Date: 星期一, 06 三月 2023 16:36:33 +0800
Subject: [PATCH] 1.节拍工价新增、编辑加工价类型字段区分自制、外协 2.工序编辑,工序类型切换保存时删除对应节拍工价表 3.工单派发时判断区分自制、外协工序 4.计件工资报表增加剔除工序参数
---
VueWebApi/DLL/DAL/ProductionManagementDAL.cs | 117 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 116 insertions(+), 1 deletions(-)
diff --git a/VueWebApi/DLL/DAL/ProductionManagementDAL.cs b/VueWebApi/DLL/DAL/ProductionManagementDAL.cs
index 68a619c..0c3c4dd 100644
--- a/VueWebApi/DLL/DAL/ProductionManagementDAL.cs
+++ b/VueWebApi/DLL/DAL/ProductionManagementDAL.cs
@@ -475,6 +475,73 @@
}
#endregion
+ #region[宸ュ崟娲惧彂閫夋嫨宸ヨ壓璺嚎鎴栭�夋嫨鐢熶骇杞﹂棿鏃跺垽鏂粦瀹氭潯浠禲
+ public static ToMessage SelectRouteOrWkshop(string partcode, string routecode, string wkshopcode)
+ {
+ string sql = "";
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ mes.code = "200";
+ mes.Message = "";
+ mes.data = null;
+ //鍒ゆ柇宸ヨ壓璺嚎瀵瑰簲宸ュ簭鏄惁閮芥湁鍏宠仈宸ヤ綔绔�
+ sql = @"select B.step_code,C.eqp_code from TFlw_Rout A
+ inner join TFlw_Rtdt B on A.code=B.rout_code
+ left join TFlw_Rteqp C on B.step_code=C.step_code
+ where A.code=@routecode";
+ dynamicParams.Add("@routecode", routecode);
+ var dtck = DapperHelper.selectdata(sql, dynamicParams);
+ for (int i = 0; i < dtck.Rows.Count; i++)
+ {
+ if (dtck.Rows[i].IsNull("eqp_code"))
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.Message = "褰撳墠宸ヨ壓璺嚎瀵瑰簲宸ュ簭銆�" + dtck.Rows[i]["step_code"].ToString() + "銆戯紝鏈叧鑱旇澶囷紝璇峰叧鑱旀墍鏈夊伐搴忓搴旇澶�!";
+ mes.data = null;
+ return mes;
+ }
+ }
+ //鍒ゆ柇宸ヨ壓璺嚎瀵瑰簲宸ュ簭鍏宠仈鐨勫伐浣滅珯鏄惁鏈夎缃妭鎷嶅伐浠�
+ sql = @"select AA.step_code,AA.eqp_code,AA.flwtype,S.unprice from (
+ select A.code,B.step_code,C.eqp_code,S.flwtype from TFlw_Rout A
+ inner join TFlw_Rtdt B on A.code=B.rout_code
+ left join TFlw_Rteqp C on B.step_code=C.step_code
+ left join TStep S on B.step_code=S.stepcode
+ where A.code=@route_code
+ ) as AA
+ left join (select * from TPrteEqp_Stad where materiel_code=@partcode and route_code=@route_code) as S on
+ AA.code=S.route_code and AA.step_code=S.step_code and AA.eqp_code=S.eqp_code";
+ dynamicParams.Add("@partcode", partcode);
+ dynamicParams.Add("@route_code", routecode);
+ var dtc = DapperHelper.selectdata(sql, dynamicParams);
+ for (int i = 0; i < dtc.Rows.Count; i++)
+ {
+ if (dtc.Rows[i]["flwtype"].ToString() == "Z") //鍒ゆ柇宸ュ簭鏄惁涓鸿嚜鍒�
+ {
+ if (dtc.Rows[i].IsNull("unprice") || decimal.Parse(dtc.Rows[i]["unprice"].ToString()) == 0)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.Message = "鑺傛媿宸ヤ环涓細褰撳墠浜у搧銆�" + partcode + "銆戯紝瀵瑰簲宸ヨ壓璺嚎銆�" + routecode + "銆戞湭璁剧疆(鎴栨湭璁剧疆鍏�)鎴栧伐浠峰皬浜庣瓑浜�0!";
+ mes.data = null;
+ return mes;
+ }
+ }
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.Message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
#region[MES宸ュ崟鏂板銆佺紪杈戞彁浜
public static ToMessage AddUpdateMesOrder(string mesorderstus, string sourceorder, string ordertype, string mesordercode, string partcode, string mesqty, string routecode, string wkshopcode, string planstartdate, string planenddate, string orderlev, string username, string opertype)
{
@@ -533,6 +600,25 @@
CreateDate = DateTime.Now.ToString()
}
});
+
+ //鍐欏叆宸ュ崟宸ヨ壓璺嚎宸ュ簭宸ヤ环澶嶅埗琛�
+ sql = @"insert into TWoPrteEqp_Stad(wo,materiel_code,eqp_code,stand_value,opc_conver,route_code,unprice,eqp_value,cavity_qty,wkspcode,lm_user,lm_date,torg_code,is_delete,step_code)
+ select distinct @mesordercode as wo,S.materiel_code,S.eqp_code,S.stand_value,S.opc_conver,S.route_code,S.unprice,
+ S.eqp_value,S.cavity_qty,S.wkspcode,S.lm_user,S.lm_date,S.torg_code,S.is_delete,S.step_code
+ from TFlw_Rtdt A
+ inner join TFlw_Rteqp C on A.step_code=C.step_code
+ inner join (select * from TPrteEqp_Stad where materiel_code=@materiel_code and route_code=@routecode) as S on C.step_code=S.step_code and C.eqp_code=S.eqp_code";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ mesordercode = mesordercode,
+ materiel_code = partcode,
+ routecode = routecode
+ }
+ });
+
//if (is_aps == "Y") //鏄惁鎺掔▼
//{
// string sql1 = "select id from TBom_Main where materiel_code='" + PartNumber + "' and status='Y' and version='" + VsionId + "'";
@@ -600,6 +686,35 @@
CreateDate = DateTime.Now.ToString()
}
});
+
+ //鍒犻櫎宸ュ崟宸ヨ壓璺嚎宸ュ簭宸ヤ环澶嶅埗琛�
+ sql = @"delete TWoPrteEqp_Stad where wo=@mesordercode";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ mesordercode = mesordercode
+ }
+ });
+ //鍐欏叆宸ュ崟宸ヨ壓璺嚎宸ュ簭宸ヤ环澶嶅埗琛�
+ sql = @"insert into TWoPrteEqp_Stad(wo,materiel_code,eqp_code,stand_value,opc_conver,route_code,unprice,eqp_value,cavity_qty,wkspcode,lm_user,lm_date,torg_code,is_delete,step_code)
+ select distinct @mesordercode as wo,S.materiel_code,S.eqp_code,S.stand_value,S.opc_conver,S.route_code,S.unprice,
+ S.eqp_value,S.cavity_qty,S.wkspcode,S.lm_user,S.lm_date,S.torg_code,S.is_delete,S.step_code
+ from TFlw_Rtdt A
+ inner join TFlw_Rteqp C on A.step_code=C.step_code
+ inner join (select * from TPrteEqp_Stad where materiel_code=@materiel_code and route_code=@routecode) as S on C.step_code=S.step_code and C.eqp_code=S.eqp_code";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ mesordercode = mesordercode,
+ materiel_code = partcode,
+ routecode = routecode
+ }
+ });
+
bool aa = DapperHelper.DoTransaction(list);
if (aa)
{
@@ -2444,7 +2559,7 @@
inner join TK_Wrk_RecordSub B on A.id=B.m_id
left join TK_Wrk_Man M on A.wo_code=M.wo_code
left join TStep S on A.step_code=S.stepcode
- left join TPrteEqp_Stad T on A.materiel_code=T.materiel_code and M.route_code=T.route_code and A.step_code=T.step_code and A.eqp_code=T.eqp_code
+ left join TWoPrteEqp_Stad T on A.wo_code=T.wo and A.materiel_code=T.materiel_code and A.eqp_code=T.eqp_code and A.step_code=T.step_code and M.route_code=T.route_code
left join TMateriel_Info P on A.materiel_code=P.partcode
left join TOrganization G on M.wkshp_code=G.org_code
left join TEqpInfo E on A.eqp_code=E.code
--
Gitblit v1.9.3