From 7ff74f599084561338eef1230db5aa45f74565f8 Mon Sep 17 00:00:00 2001
From: yl <ykxkd@outlook.com>
Date: 星期一, 15 四月 2024 18:03:33 +0800
Subject: [PATCH] 1.ERP订单关闭增加单据id 2.MES工单关闭增加源单id关联
---
VueWebCoreApi/DLL/DAL/WorkOrderDAL.cs | 1224 ++++++++++++++++++++++++++++++++++++++++++---------------
1 files changed, 894 insertions(+), 330 deletions(-)
diff --git a/VueWebCoreApi/DLL/DAL/WorkOrderDAL.cs b/VueWebCoreApi/DLL/DAL/WorkOrderDAL.cs
index 035b47a..3337a00 100644
--- a/VueWebCoreApi/DLL/DAL/WorkOrderDAL.cs
+++ b/VueWebCoreApi/DLL/DAL/WorkOrderDAL.cs
@@ -7,6 +7,8 @@
using System.Linq;
using System.Threading.Tasks;
using VueWebCoreApi.Models;
+using VueWebCoreApi.Models.ErpOrder;
+using VueWebCoreApi.Models.ReportVerify;
using VueWebCoreApi.Models.UpdateReport;
using VueWebCoreApi.Models.WorkData;
using VueWebCoreApi.Tools;
@@ -17,6 +19,7 @@
{
public static DataTable dt; //瀹氫箟鍏ㄥ眬鍙橀噺dt
public static bool res; //瀹氫箟鍏ㄥ眬鍙橀噺dt
+
public static ToMessage mes = new ToMessage(); //瀹氫箟鍏ㄥ眬杩斿洖淇℃伅瀵硅薄
public static string strProcName = ""; //瀹氫箟鍏ㄥ眬sql鍙橀噺
public static List<SqlParameter> listStr = new List<SqlParameter>(); //瀹氫箟鍏ㄥ眬鍙傛暟闆嗗悎
@@ -24,7 +27,7 @@
#region[ERP璁㈠崟鏌ヨ]
- public static ToMessage ErpOrderSearch(string erporderstus, string erpordercode, string saleordercode, string partcode, string partname, string partspec, int startNum, string paydatestartdate, string paydateenddate, string paydatestartdate1, string paydateenddate2, string creatuser, int endNum, string prop, string order)
+ public static ToMessage ErpOrderSearch(string erporderstus, string wkshopcode, string erpordercode, string saleordercode, string partcode, string partname, string partspec, int startNum, string paydatestartdate, string paydateenddate, string paydatestartdate1, string paydateenddate2, string creatuser, int endNum, string prop, string order)
{
var dynamicParams = new DynamicParameters();
string search = "";
@@ -34,6 +37,11 @@
{
search += "and A.status=@erporderstus ";
dynamicParams.Add("@erporderstus", erporderstus);
+ }
+ if (wkshopcode != "" && wkshopcode != null)
+ {
+ search += "and A.wkshp_code=@wkshopcode ";
+ dynamicParams.Add("@wkshopcode", wkshopcode);
}
if (erpordercode != "" && erpordercode != null)
{
@@ -85,7 +93,7 @@
// --------------鏌ヨ鎸囧畾鏁版嵁--------------
var total = 0; //鎬绘潯鏁�
var sql = @"select A.id, A.status,A.wo,A.materiel_code as partcode,B.partname,B.partspec,A.qty,A.relse_qty,A.wkshp_code,C.torg_name as wkshp_name,
- A.stck_code,D.name as stck_name,A.saleOrderCode,A.saleOrderDeliveryDate,A.planstartdate,A.planenddate,U.username as createuser,A.createdate,A.sbid
+ A.stck_code,D.name as stck_name,A.saleOrderCode,A.saleOrderDeliveryDate,A.planstartdate,A.planenddate,U.username as createuser,A.createdate,A.sbid,A.clerkuser
from TKimp_Ewo A
left join TMateriel_Info B on A.materiel_code=B.partcode
left join TOrganization C on A.wkshp_code=C.torg_code
@@ -94,7 +102,7 @@
where A.is_delete<>'1' " + search;
var data = DapperHelper.GetPageList<object>(sql, dynamicParams, prop, order, startNum, endNum, out total);
mes.code = "200";
- mes.Message = "鏌ヨ鎴愬姛!";
+ mes.message = "鏌ヨ鎴愬姛!";
mes.count = total;
mes.data = data.ToList();
}
@@ -102,7 +110,7 @@
{
mes.code = "300";
mes.count = 0;
- mes.Message = e.Message;
+ mes.message = e.Message;
mes.data = null;
}
return mes;
@@ -110,7 +118,7 @@
#endregion
#region[ERP璁㈠崟涓嬭揪]
- public static ToMessage MarkSaveErpOrder(string erporderid, string sbid, string erpordercode, string saleordercode, string partcode, string wkshopcode, string warehousecode, string erpqty, string markqty, string ordernum, string relse_qty, string saleOrderDeliveryDate, User us)
+ public static ToMessage MarkSaveErpOrder(string erporderid, string sbid, string erpordercode, string saleordercode, string partcode, string wkshopcode, string warehousecode, string erpqty, string markqty, string ordernum, string relse_qty, string saleOrderDeliveryDate,string clerkuser, User us)
{
var sql = "";
List<object> list = new List<object>();
@@ -148,7 +156,7 @@
}
if (i == Convert.ToInt32(ordernum)) //鏈�鍚庝竴鍗曟椂
{
- sql = @"insert into TK_Wrk_Man(wo_code,wotype,status,wkshp_code,plan_qty,stck_code,sbid,materiel_code,sourceid,m_po,lm_user,lm_date,saleOrderCode,saleOrderDeliveryDate,data_sources,isstep) values(@wo_code,@wotype,@status,@wkshp_code,@plan_qty,@stck_code,@sbid,@materiel_code,@sourceid,@m_po,@username,@CreateDate,@saleOrderCode,@saleOrderDeliveryDate,@data_sources,@isstep)";
+ sql = @"insert into TK_Wrk_Man(wo_code,wotype,status,wkshp_code,plan_qty,stck_code,sbid,materiel_code,sourceid,m_po,lm_user,lm_date,saleOrderCode,saleOrderDeliveryDate,data_sources,isstep,clerkuser) values(@wo_code,@wotype,@status,@wkshp_code,@plan_qty,@stck_code,@sbid,@materiel_code,@sourceid,@m_po,@username,@CreateDate,@saleOrderCode,@saleOrderDeliveryDate,@data_sources,@isstep,@clerkuser)";
list.Add(new
{
str = sql,
@@ -169,7 +177,8 @@
saleOrderCode = saleordercode,
saleOrderDeliveryDate = Convert.ToDateTime(saleOrderDeliveryDate),
data_sources = "ERP",
- isstep = "N" //鏄惁鍏宠仈宸ュ簭
+ isstep = "N", //鏄惁鍏宠仈宸ュ簭
+ clerkuser= clerkuser //閿�鍞鍗曚笟鍔″憳
}
});
sumqty = sumqty + (decimal.Parse(markqty) - sumqty);
@@ -177,7 +186,7 @@
else
{
- sql = @"insert into TK_Wrk_Man(wo_code,wotype,status,wkshp_code,plan_qty,stck_code,sbid,materiel_code,sourceid,m_po,lm_user,lm_date,saleOrderCode,saleOrderDeliveryDate,data_sources,isstep) values(@wo_code,@wotype,@status,@wkshp_code,@plan_qty,@stck_code,@sbid,@materiel_code,@sourceid,@m_po,@username,@CreateDate,@saleOrderCode,@saleOrderDeliveryDate,@data_sources,@isstep)";
+ sql = @"insert into TK_Wrk_Man(wo_code,wotype,status,wkshp_code,plan_qty,stck_code,sbid,materiel_code,sourceid,m_po,lm_user,lm_date,saleOrderCode,saleOrderDeliveryDate,data_sources,isstep,clerkuser) values(@wo_code,@wotype,@status,@wkshp_code,@plan_qty,@stck_code,@sbid,@materiel_code,@sourceid,@m_po,@username,@CreateDate,@saleOrderCode,@saleOrderDeliveryDate,@data_sources,@isstep,@clerkuser)";
list.Add(new
{
str = sql,
@@ -198,7 +207,8 @@
saleOrderCode = saleordercode,
saleOrderDeliveryDate = Convert.ToDateTime(saleOrderDeliveryDate),
data_sources = "ERP",
- isstep = "N"//鏄惁鍏宠仈宸ュ簭
+ isstep = "N",//鏄惁鍏宠仈宸ュ簭
+ clerkuser= clerkuser
}
});
}
@@ -240,14 +250,14 @@
LogHelper.DbOperateLog(us.usercode, "涓嬭揪", "涓嬭揪浜嗗伐鍗�:" + wo, us.usertype);
mes.code = "200";
mes.count = 0;
- mes.Message = "涓嬭揪MES宸ュ崟鎴愬姛!";
+ mes.message = "涓嬭揪MES宸ュ崟鎴愬姛!";
mes.data = null;
}
else
{
mes.code = "300";
mes.count = 0;
- mes.Message = "涓嬭揪MES宸ュ崟鎴愬姛澶辫触!";
+ mes.message = "涓嬭揪MES宸ュ崟鎴愬姛澶辫触!";
mes.data = null;
}
}
@@ -255,7 +265,110 @@
{
mes.code = "300";
mes.count = 0;
- mes.Message = e.Message;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[璁㈠崟鎵归噺涓嬭揪]
+ public static ToMessage MarkBatchSaveErpOrder(List<ErpOrderBatch> obj, User us)
+ {
+ var sql = "";
+ List<object> list = new List<object>();
+ var dynamicParams = new DynamicParameters();
+
+ try
+ {
+ list.Clear();
+ string result = "";
+ //var groupedModels = obj.GroupBy(m => m.erpordercode);
+ var groupedModels = obj.GroupBy(s => s.erpordercode).Select(g => new { erpordercode = g.Key }).ToList();
+ foreach (var group in groupedModels)
+ {
+ string erpordercode = group.erpordercode;
+ int count = 1;
+ foreach (var model in obj.Where(s => s.erpordercode==erpordercode).ToList())
+ {
+ //鑾峰彇褰撳墠鏈�澶у伐鍗曞彿
+ sql = @"select isnull(max(cast(substring(wo_code,charindex('_',wo_code)+1,len(wo_code)-charindex('_',wo_code)) as numeric)),0) as worknumb
+ from TK_Wrk_Man where m_po=@erpordercode";
+ dynamicParams.Add("@erpordercode", model.erpordercode);
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ int num = Convert.ToInt32(data.Rows[0]["WORKNUMB"].ToString());
+ string wo = model.erpordercode + "_" + (num + count);
+ result += wo.ToString() + ",";
+ //鍐欏叆宸ュ崟琛�
+ sql = @"insert into TK_Wrk_Man(wo_code,wotype,status,wkshp_code,plan_qty,stck_code,sbid,materiel_code,sourceid,m_po,lm_user,lm_date,saleOrderCode,saleOrderDeliveryDate,data_sources,isstep,clerkuser) values(@wo_code,@wotype,@status,@wkshp_code,@plan_qty,@stck_code,@sbid,@materiel_code,@sourceid,@m_po,@username,@CreateDate,@saleOrderCode,@saleOrderDeliveryDate,@data_sources,@isstep,@clerkuser)";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ wo_code = wo,
+ wotype = "PO",
+ status = "NEW",
+ wkshp_code = model.wkshopcode,
+ plan_qty = decimal.Parse(model.erpqty), //璁㈠崟鏁伴噺
+ stck_code = model.warehousecode,
+ sbid = model.sbid,
+ materiel_code = model.partcode,
+ sourceid = model.erporderid,
+ m_po = model.erpordercode,
+ username = us.usercode,
+ CreateDate = DateTime.Now.ToString(),
+ saleOrderCode = model.saleordercode,
+ saleOrderDeliveryDate = Convert.ToDateTime(model.saleOrderDeliveryDate),
+ data_sources = "ERP",
+ isstep = "N", //鏄惁鍏宠仈宸ュ簭
+ clerkuser= model.clerkuser //閿�鍞鍗曚笟鍔″憳
+ }
+ });
+
+ //鏇存柊璁㈠崟鐘舵��
+ sql = @"update TKimp_Ewo set status='CREATED',saleOrderDeliveryDate=@saleOrderDeliveryDate,relse_qty=relse_qty+@sumqty where wo=@wo and id=@erporderid";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ wo = model.erpordercode,
+ erporderid = model.erporderid,
+ sumqty = decimal.Parse(model.markqty),
+ saleOrderDeliveryDate = Convert.ToDateTime(model.saleOrderDeliveryDate)
+ }
+ });
+ count++;
+ }
+ }
+
+
+
+ bool aa = DapperHelper.DoTransaction(list);
+ if (aa)
+ {
+ //鍐欏叆鎿嶄綔璁板綍琛�
+ LogHelper.DbOperateLog(us.usercode, "鎵归噺涓嬭揪", "鎵归噺涓嬭揪浜嗗伐鍗�:" + result.TrimEnd(','), us.usertype);
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "鎵归噺涓嬭揪MES宸ュ崟鎴愬姛!";
+ mes.data = null;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "鎵归噺涓嬭揪MES宸ュ崟鎴愬姛澶辫触!";
+ mes.data = null;
+ }
+
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
mes.data = null;
}
return mes;
@@ -270,15 +383,17 @@
var dynamicParams = new DynamicParameters();
try
{
- sql = @"select * from TK_Wrk_Man where m_po=@erpordercode and status<> 'CLOSED'";
+ sql = @"select * from TK_Wrk_Man where m_po=@erpordercode and sourceid=@sourceid and status<> 'CLOSED'";
dynamicParams.Add("@erpordercode", erpordercode);
+ dynamicParams.Add("@sourceid", erporderid);
var data = DapperHelper.selectdata(sql, dynamicParams);
if (data.Rows.Count > 0)
{
mes.code = "300";
mes.count = 0;
- mes.Message = "褰撳墠璁㈠崟鏈変笅杈炬湭鍏抽棴鐨凪ES宸ュ崟,璁㈠崟涓嶅厑璁稿叧闂�,璇峰厛鍒犻櫎鎴栧叧闂浉鍏冲伐鍗�!";
+ mes.message = "褰撳墠璁㈠崟浜у搧鏈変笅杈炬湭鍏抽棴鐨凪ES宸ュ崟,璁㈠崟涓嶅厑璁稿叧闂�,璇峰厛鍒犻櫎鎴栧叧闂浉鍏冲伐鍗�!";
mes.data = null;
+ return mes;
}
else
{
@@ -301,14 +416,14 @@
LogHelper.DbOperateLog(us.usercode, "鍏抽棴", "鍏抽棴浜嗚鍗�:" + erpordercode, us.usertype);
mes.code = "200";
mes.count = 0;
- mes.Message = "璁㈠崟鍏抽棴鎴愬姛!";
+ mes.message = "璁㈠崟鍏抽棴鎴愬姛!";
mes.data = null;
}
else
{
mes.code = "300";
mes.count = 0;
- mes.Message = "璁㈠崟鍏抽棴澶辫触!";
+ mes.message = "璁㈠崟鍏抽棴澶辫触!";
mes.data = null;
}
}
@@ -316,7 +431,7 @@
{
mes.code = "300";
mes.count = 0;
- mes.Message = e.Message;
+ mes.message = e.Message;
mes.data = null;
}
return mes;
@@ -339,7 +454,7 @@
{
mes.code = "300";
mes.count = 0;
- mes.Message = "褰撳墠璁㈠崟涓嬫湁宸ュ崟宸叉淳鍙戞垨宸插紑宸ユ垨宸插畬宸�(鍏抽棴),涓嶅厑璁稿垹闄�!";
+ mes.message = "褰撳墠璁㈠崟涓嬫湁宸ュ崟宸叉淳鍙戞垨宸插紑宸ユ垨宸插畬宸�(鍏抽棴),涓嶅厑璁稿垹闄�!";
mes.data = null;
return mes;
}
@@ -376,14 +491,14 @@
LogHelper.DbOperateLog(us.usercode, "鍒犻櫎", "鍒犻櫎浜嗚鍗�:" + erpordercode, us.usertype);
mes.code = "200";
mes.count = 0;
- mes.Message = "璁㈠崟鍒犻櫎鎴愬姛!";
+ mes.message = "璁㈠崟鍒犻櫎鎴愬姛!";
mes.data = null;
}
else
{
mes.code = "300";
mes.count = 0;
- mes.Message = "璁㈠崟鍒犻櫎澶辫触!";
+ mes.message = "璁㈠崟鍒犻櫎澶辫触!";
mes.data = null;
}
}
@@ -391,7 +506,7 @@
{
mes.code = "300";
mes.count = 0;
- mes.Message = e.Message;
+ mes.message = e.Message;
mes.data = null;
}
return mes;
@@ -401,7 +516,7 @@
#region[MES宸ュ崟鏌ヨ]
- public static ToMessage MesOrderSearch(string mesorderstus, string mesordercode, string sourceorder, string saleordercode, string ordertype, string partcode, string partname, string partspec, int startNum, string creatuser, string createdate, int endNum, string prop, string order)
+ public static ToMessage MesOrderSearch(string mesorderstus, string wkshopcode, string mesordercode, string sourceorder, string saleordercode, string ordertype, string partcode, string partname, string partspec, int startNum, string creatuser, string createdate, int endNum, string prop, string order)
{
var dynamicParams = new DynamicParameters();
string search = "";
@@ -411,6 +526,11 @@
{
search += "and A.status=@mesorderstus ";
dynamicParams.Add("@mesorderstus", mesorderstus);
+ }
+ if (wkshopcode != "" && wkshopcode != null)
+ {
+ search += "and A.wkshp_code=@wkshopcode ";
+ dynamicParams.Add("@wkshopcode", wkshopcode);
}
if (mesordercode != "" && mesordercode != null)
{
@@ -465,9 +585,9 @@
// --------------鏌ヨ鎸囧畾鏁版嵁--------------
var total = 0; //鎬绘潯鏁�
var sql = @"select A.id, A.status,A.wotype,A.wo_code,A.materiel_code as partcode,B.partname,B.partspec,A.plan_qty,A.wkshp_code,C.torg_name as wkshp_name,
- A.stck_code,D.name as stck_name,A.plan_startdate,A.plan_enddate,A.piroque,A.sourceid,A.m_po,A.saleOrderDeliveryDate,W.saleOrderCode,U.username as lm_user,A.lm_date,A.data_sources,A.isstep
+ A.stck_code,D.name as stck_name,A.plan_startdate,A.plan_enddate,A.piroque,A.sourceid,A.m_po,A.saleOrderDeliveryDate,W.saleOrderCode,U.username as lm_user,A.lm_date,A.data_sources,A.isstep,A.clerkuser
from TK_Wrk_Man A
- left join TKimp_Ewo W on A.m_po=W.wo and A.materiel_code=W.materiel_code
+ left join TKimp_Ewo W on A.m_po=W.wo and A.materiel_code=W.materiel_code and A.sbid=W.sbid
left join TMateriel_Info B on A.materiel_code=B.partcode
left join TOrganization C on A.wkshp_code=C.torg_code
left join TSecStck D on A.stck_code=D.code
@@ -476,7 +596,7 @@
where A.is_delete<>'1' " + search;
var data = DapperHelper.GetPageList<object>(sql, dynamicParams, prop, order, startNum, endNum, out total);
mes.code = "200";
- mes.Message = "鏌ヨ鎴愬姛!";
+ mes.message = "鏌ヨ鎴愬姛!";
mes.count = total;
mes.data = data.ToList();
}
@@ -484,7 +604,7 @@
{
mes.code = "300";
mes.count = 0;
- mes.Message = e.Message;
+ mes.message = e.Message;
mes.data = null;
}
return mes;
@@ -492,12 +612,17 @@
#endregion
#region[MES鎶ュ簾琛ュ崟宸ュ崟鏌ヨ]
- public static ToMessage MesBadOrderSearch(string mesordercode, string sourceorder, string saleordercode, string partcode, string partname, string partspec, int startNum, string creatuser, string createdate, int endNum, string prop, string order)
+ public static ToMessage MesBadOrderSearch(string wkshopcode, string mesordercode, string sourceorder, string saleordercode, string partcode, string partname, string partspec, int startNum, string creatuser, string createdate, int endNum, string prop, string order)
{
var dynamicParams = new DynamicParameters();
string search = "";
try
{
+ if (wkshopcode != "" && wkshopcode != null)
+ {
+ search += "and A.wkshp_code=@wkshopcode ";
+ dynamicParams.Add("@wkshopcode", wkshopcode);
+ }
if (mesordercode != "" && mesordercode != null)
{
search += "and A.wo_code like '%'+@mesordercode+'%' ";
@@ -548,7 +673,7 @@
var sql = @"select A.id, A.status,A.wotype,A.wo_code,A.materiel_code as partcode,B.partname,B.partspec,A.plan_qty,A.wkshp_code,C.torg_name as wkshp_name,
A.stck_code,D.name as stck_name,A.plan_startdate,A.plan_enddate,A.piroque,A.sourceid,A.m_po,A.saleOrderDeliveryDate,W.saleOrderCode,U.username as lm_user,A.lm_date,S.laborbad_qty,S.materielbad_qty
from TK_Wrk_Man A
- left join TKimp_Ewo W on A.m_po=W.wo and A.materiel_code=W.materiel_code
+ left join TKimp_Ewo W on A.m_po=W.wo and A.materiel_code=W.materiel_code and A.sbid=W.sbid
left join (select wo_code,isnull(sum(laborbad_qty),0) as laborbad_qty,isnull(sum(materielbad_qty),0) as materielbad_qty from TK_Wrk_Step where (laborbad_qty+materielbad_qty)>0 group by wo_code) S on A.wo_code=S.wo_code
left join TMateriel_Info B on A.materiel_code=B.partcode
left join TOrganization C on A.wkshp_code=C.torg_code
@@ -557,7 +682,7 @@
where A.is_delete<>'1' and (S.laborbad_qty+S.materielbad_qty)>0 " + search;
var data = DapperHelper.GetPageList<object>(sql, dynamicParams, prop, order, startNum, endNum, out total);
mes.code = "200";
- mes.Message = "鏌ヨ鎴愬姛!";
+ mes.message = "鏌ヨ鎴愬姛!";
mes.count = total;
mes.data = data.ToList();
}
@@ -565,7 +690,7 @@
{
mes.code = "300";
mes.count = 0;
- mes.Message = e.Message;
+ mes.message = e.Message;
mes.data = null;
}
return mes;
@@ -585,14 +710,14 @@
FROM TK_Wrk_Man where wo_code like '%SGPO%'";
var data = DapperHelper.selecttable(sql);
mes.code = "200";
- mes.Message = "鏌ヨ鎴愬姛!";
+ mes.message = "鏌ヨ鎴愬姛!";
mes.data = data.Rows[0]["numct"].ToString();
}
catch (Exception e)
{
mes.code = "300";
mes.count = 0;
- mes.Message = e.Message;
+ mes.message = e.Message;
mes.data = null;
}
return mes;
@@ -654,14 +779,14 @@
dir.Add("stepdata", data1);
mes.code = "200";
mes.count = data1.Rows.Count;
- mes.Message = "鏌ヨ鎴愬姛";
+ mes.message = "鏌ヨ鎴愬姛";
mes.data = dir;
}
catch (Exception e)
{
mes.code = "300";
mes.count = 0;
- mes.Message = e.Message;
+ mes.message = e.Message;
mes.data = null;
}
return mes;
@@ -733,14 +858,14 @@
LogHelper.DbOperateLog(us.usercode, "鏂板", "鏂板浜嗗伐鍗�:" + json.wocode, us.usertype);
mes.code = "200";
mes.count = 0;
- mes.Message = "MES宸ュ崟鏂板缓鎴愬姛!";
+ mes.message = "MES宸ュ崟鏂板缓鎴愬姛!";
mes.data = null;
}
else
{
mes.code = "300";
mes.count = 0;
- mes.Message = "MES宸ュ崟鏂板缓澶辫触!";
+ mes.message = "MES宸ュ崟鏂板缓澶辫触!";
mes.data = null;
}
}
@@ -809,14 +934,14 @@
LogHelper.DbOperateLog(us.usercode, "淇敼", "淇敼浜嗗伐鍗�:" + json.wocode, us.usertype);
mes.code = "200";
mes.count = 0;
- mes.Message = "淇敼鎿嶄綔鎴愬姛!";
+ mes.message = "淇敼鎿嶄綔鎴愬姛!";
mes.data = null;
}
else
{
mes.code = "300";
mes.count = 0;
- mes.Message = "淇敼鎿嶄綔澶辫触!";
+ mes.message = "淇敼鎿嶄綔澶辫触!";
mes.data = null;
}
}
@@ -825,7 +950,7 @@
{
mes.code = "300";
mes.count = 0;
- mes.Message = e.Message;
+ mes.message = e.Message;
mes.data = null;
}
return mes;
@@ -883,7 +1008,7 @@
{
mes.code = "300";
mes.count = 0;
- mes.Message = "宸ュ崟鎵ц涓垨宸插叧闂紝涓嶅厑璁稿垹闄�!";
+ mes.message = "宸ュ崟鎵ц涓垨宸插叧闂紝涓嶅厑璁稿垹闄�!";
mes.data = null;
}
bool aa = DapperHelper.DoTransaction(list);
@@ -893,14 +1018,14 @@
LogHelper.DbOperateLog(us.usercode, "鍒犻櫎", "鍒犻櫎浜嗗伐鍗�:" + wocode, us.usertype);
mes.code = "200";
mes.count = 0;
- mes.Message = "鍒犻櫎鎴愬姛!";
+ mes.message = "鍒犻櫎鎴愬姛!";
mes.data = null;
}
else
{
mes.code = "300";
mes.count = 0;
- mes.Message = "鍒犻櫎澶辫触!";
+ mes.message = "鍒犻櫎澶辫触!";
mes.data = null;
}
}
@@ -908,7 +1033,45 @@
{
mes.code = "300";
mes.count = 0;
- mes.Message = e.Message;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[MES宸ュ崟鏌ユ壘鍘嗗彶寮曠敤鏈�鏂板伐搴忎俊鎭痌
+ public static ToMessage MesOrderNewStepContent(string wkshopcode, string partcode, User us)
+ {
+ var sql = "";
+ List<object> list = new List<object>();
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ //MES宸ュ崟鏌ユ壘鍘嗗彶寮曠敤鏈�鏂板伐搴忎俊鎭�
+ sql = @"select S.wo_code,S.seq,S.step_code,S.stepprice,isbott,isend
+ from TK_Wrk_Step S
+ inner join (
+ select top 1 A.wo_code from TK_Wrk_Man A
+ inner join TK_Wrk_Step S on A.wo_code=S.wo_code
+ where A.materiel_code=@partcode and A.wkshp_code=@wkshopcode
+ order by A.lm_date desc
+ ) as W on S.wo_code=W.wo_code
+ left join TStep T on S.step_code=T.stepcode
+ order by S.seq";
+ dynamicParams.Add("@wkshopcode", wkshopcode);
+ dynamicParams.Add("@partcode", partcode);
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ mes.code = "200";
+ mes.count = data.Rows.Count;
+ mes.data = data;
+ mes.message = "鏌ヨ鎴愬姛!";
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
mes.data = null;
}
return mes;
@@ -952,14 +1115,14 @@
LogHelper.DbOperateLog(us.usercode, "娲惧彂", "娲惧彂浜嗗伐鍗�:" + string.Join(",", wocodelist), us.usertype);
mes.code = "200";
mes.count = 0;
- mes.Message = "MES宸ュ崟娲惧彂鎴愬姛!";
+ mes.message = "MES宸ュ崟娲惧彂鎴愬姛!";
mes.data = null;
}
else
{
mes.code = "300";
mes.count = 0;
- mes.Message = "MES宸ュ缓娲惧彂澶辫触!";
+ mes.message = "MES宸ュ缓娲惧彂澶辫触!";
mes.data = null;
}
@@ -968,7 +1131,7 @@
{
mes.code = "300";
mes.count = 0;
- mes.Message = e.Message;
+ mes.message = e.Message;
mes.data = null;
}
return mes;
@@ -977,7 +1140,7 @@
#region[宸ュ崟鍏抽棴鍒楄〃鏌ヨ]
- public static ToMessage MesOrderClosedSearch(string mesorderstus, string mesordercode, string sourceorder, string saleordercode, string ordertype, string partcode, string partname, string partspec, int startNum, string creatuser, string createdate, int endNum, string prop, string order)
+ public static ToMessage MesOrderClosedSearch(string mesorderstus, string wkshopcode, string mesordercode, string sourceorder, string saleordercode, string ordertype, string partcode, string partname, string partspec, int startNum, string creatuser, string createdate, int endNum, string prop, string order)
{
var dynamicParams = new DynamicParameters();
string search = "";
@@ -992,6 +1155,11 @@
{
search += "and A.status<>@mesorderstus ";
dynamicParams.Add("@mesorderstus", "CLOSED");
+ }
+ if (wkshopcode != "" && wkshopcode != null)
+ {
+ search += "and A.wkshp_code=@wkshopcode ";
+ dynamicParams.Add("@wkshopcode", wkshopcode);
}
if (mesordercode != "" && mesordercode != null)
{
@@ -1048,7 +1216,7 @@
var sql = @"select A.id, A.status,A.wotype,A.wo_code,A.materiel_code as partcode,B.partname,B.partspec,A.plan_qty,A.wkshp_code,C.torg_name as wkshp_name,
A.stck_code,D.name as stck_name,A.plan_startdate,A.plan_enddate,A.piroque,A.sourceid,A.m_po,A.saleOrderDeliveryDate,W.saleOrderCode,U.username as lm_user,A.lm_date,A.data_sources
from TK_Wrk_Man A
- left join TKimp_Ewo W on A.m_po=W.wo and A.materiel_code=W.materiel_code
+ left join TKimp_Ewo W on A.m_po=W.wo and A.materiel_code=W.materiel_code and A.sourceid=W.id
left join TMateriel_Info B on A.materiel_code=B.partcode
left join TOrganization C on A.wkshp_code=C.torg_code
left join TSecStck D on A.stck_code=D.code
@@ -1057,7 +1225,7 @@
where A.is_delete<>'1' " + search;
var data = DapperHelper.GetPageList<object>(sql, dynamicParams, prop, order, startNum, endNum, out total);
mes.code = "200";
- mes.Message = "鏌ヨ鎴愬姛!";
+ mes.message = "鏌ヨ鎴愬姛!";
mes.count = total;
mes.data = data.ToList();
}
@@ -1065,7 +1233,7 @@
{
mes.code = "300";
mes.count = 0;
- mes.Message = e.Message;
+ mes.message = e.Message;
mes.data = null;
}
return mes;
@@ -1096,14 +1264,14 @@
LogHelper.DbOperateLog(us.usercode, "鍏抽棴", "鍏抽棴浜嗗伐鍗�:" + string.Join(",", wocodelist), us.usertype);
mes.code = "200";
mes.count = 0;
- mes.Message = "宸ュ崟鍏抽棴鎴愬姛!";
+ mes.message = "宸ュ崟鍏抽棴鎴愬姛!";
mes.data = null;
}
else
{
mes.code = "300";
mes.count = 0;
- mes.Message = "宸ュ崟鍏抽棴澶辫触!";
+ mes.message = "宸ュ崟鍏抽棴澶辫触!";
mes.data = null;
}
}
@@ -1111,7 +1279,7 @@
{
mes.code = "300";
mes.count = 0;
- mes.Message = e.Message;
+ mes.message = e.Message;
mes.data = null;
}
return mes;
@@ -1120,7 +1288,7 @@
#region[鐢熶骇寮�鎶ュ伐鎵爜鑾峰彇宸ュ崟瀵瑰簲宸ュ簭浠诲姟(鑷埗)]
- public static ToMessage MesOrderStepSearch(string wocode, string partcode, string partname, string partspec, int startNum, int endNum, string prop, string order)
+ public static ToMessage MesOrderStepSearch(string wkshopcode, string wocode, string partcode, string partname, string partspec, int startNum, int endNum, string prop, string order)
{
var sql = "";
string search = "";
@@ -1130,6 +1298,11 @@
var total = 0; //鎬绘潯鏁�
try
{
+ if (wkshopcode != "" && wkshopcode != null)
+ {
+ search += "and B.wkshp_code=@wkshopcode ";
+ dynamicParams.Add("@wkshopcode", wkshopcode);
+ }
if (wocode != "" && wocode != null)
{
string[] arra = wocode.Split(';');
@@ -1168,7 +1341,7 @@
{
mes.code = "300";
mes.count = 0;
- mes.Message = "褰撳墠宸ュ簭浠诲姟涓哄鍗忓伐搴忎换鍔�,璇峰墠寰�澶栧崗鎿嶄綔椤电鎵ц!";
+ mes.message = "褰撳墠宸ュ簭浠诲姟涓哄鍗忓伐搴忎换鍔�,璇峰墠寰�澶栧崗鎿嶄綔椤电鎵ц!";
mes.data = null;
return mes;
}
@@ -1190,17 +1363,18 @@
dynamicParams.Add("@partspec", partspec);
}
//鏍规嵁鏉′欢鏌ヨ宸ュ崟宸ュ簭浠诲姟(鑷埗宸ュ簭)
- sql = @"select A.id,A.status,A.wo_code,M.partcode,M.partname,M.partspec,A.seq,A.isbott,A.isend,
+ sql = @"select A.id,A.status,B.wkshp_code,T.torg_name as wkshp_name,A.wo_code,M.partcode,M.partname,M.partspec,A.seq,A.isbott,A.isend,
S.stepcode,S.stepname,S.descr,A.plan_qty,A.good_qty,A.ng_qty,A.laborbad_qty,A.materielbad_qty,B.lm_date
from TK_Wrk_Step A
left join TK_Wrk_Man B on A.wo_code=B.wo_code
left join TMateriel_Info M on B.materiel_code=M.partcode
left join TStep S on A.step_code=S.stepcode
+ left join TOrganization T on B.wkshp_code=T.torg_code
where A.status in('ALLO','START') and S.flwtype='Z' " + search;
var data = DapperHelper.GetPageList<object>(sql, dynamicParams, prop, order, startNum, endNum, out total);
mes.code = "200";
mes.count = total;
- mes.Message = "鏌ヨ鎴愬姛!";
+ mes.message = "鏌ヨ鎴愬姛!";
mes.data = data.ToList();
return mes;
}
@@ -1208,7 +1382,7 @@
{
mes.code = "300";
mes.count = 0;
- mes.Message = e.Message;
+ mes.message = e.Message;
mes.data = null;
}
return mes;
@@ -1216,7 +1390,7 @@
#endregion
#region[鐢熶骇寮�鎶ュ伐鎵爜鑾峰彇宸ュ崟瀵瑰簲宸ュ簭浠诲姟(澶栧崗)]
- public static ToMessage MesOrderWxStepSearch(string wocode, string partcode, string partname, string partspec, int startNum, int endNum, string prop, string order)
+ public static ToMessage MesOrderWxStepSearch(string wkshopcode, string wocode, string partcode, string partname, string partspec, int startNum, int endNum, string prop, string order)
{
var sql = "";
string search = "";
@@ -1226,6 +1400,11 @@
var total = 0; //鎬绘潯鏁�
try
{
+ if (wkshopcode != "" && wkshopcode != null)
+ {
+ search += "and B.wkshp_code=@wkshopcode ";
+ dynamicParams.Add("@wkshopcode", wkshopcode);
+ }
if (wocode != "" && wocode != null)
{
string[] arra = wocode.Split(';');
@@ -1264,7 +1443,7 @@
{
mes.code = "300";
mes.count = 0;
- mes.Message = "褰撳墠宸ュ簭浠诲姟涓鸿嚜鍒跺伐搴忎换鍔�,璇峰墠寰�鑷埗鎿嶄綔椤电鎵ц!";
+ mes.message = "褰撳墠宸ュ簭浠诲姟涓鸿嚜鍒跺伐搴忎换鍔�,璇峰墠寰�鑷埗鎿嶄綔椤电鎵ц!";
mes.data = null;
return mes;
}
@@ -1286,7 +1465,7 @@
dynamicParams.Add("@partspec", partspec);
}
//鏍规嵁鏉′欢鏌ヨ宸ュ崟宸ュ簭浠诲姟(鑷埗宸ュ簭)
- sql = @"select A.id,A.status,A.wo_code,M.partcode,M.partname,M.partspec,A.seq,A.isbott,A.isend,
+ sql = @"select A.id,A.status,B.wkshp_code,T.torg_name as wkshp_name,A.wo_code,M.partcode,M.partname,M.partspec,A.seq,A.isbott,A.isend,
S.stepcode,S.stepname,S.descr,A.plan_qty,A.good_qty,A.ng_qty,
(select isnull(sum(fqty),0) as fqty from TK_Wrk_OutRecord where wo_code=A.wo_code and step_code=A.step_code and style='F') as fqty,
A.laborbad_qty,A.materielbad_qty,A.plan_startdate,A.plan_enddate,B.lm_date
@@ -1294,11 +1473,12 @@
left join TK_Wrk_Man B on A.wo_code=B.wo_code
left join TMateriel_Info M on B.materiel_code=M.partcode
left join TStep S on A.step_code=S.stepcode
+ left join TOrganization T on B.wkshp_code=T.torg_code
where A.status in('ALLO','START') and S.flwtype='W' " + search;
var data = DapperHelper.GetPageList<object>(sql, dynamicParams, prop, order, startNum, endNum, out total);
mes.code = "200";
mes.count = total;
- mes.Message = "鏌ヨ鎴愬姛!";
+ mes.message = "鏌ヨ鎴愬姛!";
mes.data = data.ToList();
return mes;
@@ -1307,7 +1487,7 @@
{
mes.code = "300";
mes.count = 0;
- mes.Message = e.Message;
+ mes.message = e.Message;
mes.data = null;
}
return mes;
@@ -1315,7 +1495,7 @@
#endregion
#region[鐢熶骇寮�鎶ュ伐鎵爜鑾峰彇宸ュ崟瀵瑰簲宸ュ簭浠诲姟(涓嶈壇)]
- public static ToMessage MesOrderNgStepSearch(string wocode, string partcode, string partname, string partspec, int startNum, int endNum, string prop, string order)
+ public static ToMessage MesOrderNgStepSearch(string wkshopcode, string wocode, string partcode, string partname, string partspec, int startNum, int endNum, string prop, string order)
{
var sql = "";
string search = "";
@@ -1325,6 +1505,11 @@
var total = 0; //鎬绘潯鏁�
try
{
+ if (wkshopcode != "" && wkshopcode != null)
+ {
+ search += "and B.wkshp_code=@wkshopcode ";
+ dynamicParams.Add("@wkshopcode", wkshopcode);
+ }
if (wocode != "" && wocode != null)
{
string[] arra = wocode.Split(';');
@@ -1362,7 +1547,7 @@
{
mes.code = "300";
mes.count = 0;
- mes.Message = "褰撳墠宸ュ簭浠诲姟涓嶅瓨鍦�,鏃犳晥鏉$爜!";
+ mes.message = "褰撳墠宸ュ簭浠诲姟涓嶅瓨鍦�,鏃犳晥鏉$爜!";
mes.data = null;
return mes;
}
@@ -1383,17 +1568,18 @@
dynamicParams.Add("@partspec", partspec);
}
//鏍规嵁鏉′欢鏌ヨ宸ュ崟宸ュ簭浠诲姟(鑷埗宸ュ簭)
- sql = @"select A.id,A.wo_code,M.partcode,M.partname,M.partspec,A.seq,A.isend,
+ sql = @"select A.id,B.wkshp_code,T.torg_name as wkshp_name,A.wo_code,M.partcode,M.partname,M.partspec,A.seq,A.isend,
S.stepcode,S.stepname,S.descr,A.plan_qty,A.good_qty,A.ng_qty,A.laborbad_qty,A.materielbad_qty,B.lm_date
from TK_Wrk_Step A
left join TK_Wrk_Man B on A.wo_code=B.wo_code
left join TMateriel_Info M on B.materiel_code=M.partcode
left join TStep S on A.step_code=S.stepcode
+ left join TOrganization T on B.wkshp_code=T.torg_code
where A.status in('ALLO','START') and A.ng_qty>0 " + search;
var data = DapperHelper.GetPageList<object>(sql, dynamicParams, prop, order, startNum, endNum, out total);
mes.code = "200";
mes.count = total;
- mes.Message = "鏌ヨ鎴愬姛!";
+ mes.message = "鏌ヨ鎴愬姛!";
mes.data = data.ToList();
return mes;
}
@@ -1401,7 +1587,7 @@
{
mes.code = "300";
mes.count = 0;
- mes.Message = e.Message;
+ mes.message = e.Message;
mes.data = null;
}
return mes;
@@ -1466,7 +1652,7 @@
{
mes.code = "300";
mes.count = 0;
- mes.Message = "褰撳墠宸ュ簭浠诲姟涓嶅瓨鍦�!";
+ mes.message = "褰撳墠宸ュ簭浠诲姟涓嶅瓨鍦�!";
mes.data = null;
return mes;
}
@@ -1482,14 +1668,14 @@
list.Add("data2", dt);
mes.code = "200";
mes.count = 0;
- mes.Message = "鏌ヨ鎴愬姛!";
+ mes.message = "鏌ヨ鎴愬姛!";
mes.data = list;
}
else
{
mes.code = "300";
mes.count = 0;
- mes.Message = "鏃犲彲鎵ц鐨勭敓浜т换鍔�,浠诲姟宸插畬鎴愭垨宸插叧闂�!";
+ mes.message = "鏃犲彲鎵ц鐨勭敓浜т换鍔�,浠诲姟宸插畬鎴愭垨宸插叧闂�!";
mes.data = null;
}
}
@@ -1497,7 +1683,7 @@
{
mes.code = "300";
mes.count = 0;
- mes.Message = e.Message;
+ mes.message = e.Message;
mes.data = null;
}
return mes;
@@ -1526,7 +1712,7 @@
{
mes.code = "300";
mes.count = 0;
- mes.Message = e.Message;
+ mes.message = e.Message;
mes.data = null;
}
return mes;
@@ -1586,14 +1772,14 @@
LogHelper.DbOperateLog(us.usercode, "寮�宸�", "寮�宸ヤ簡宸ュ崟:" + mesordercode + "宸ュ簭:" + stepcode, us.usertype);
mes.code = "200";
mes.count = 0;
- mes.Message = "鎿嶄綔鎴愬姛!";
+ mes.message = "鎿嶄綔鎴愬姛!";
mes.data = null;
}
else
{
mes.code = "300";
mes.count = 0;
- mes.Message = "鎿嶄綔澶辫触!";
+ mes.message = "鎿嶄綔澶辫触!";
mes.data = null;
}
}
@@ -1615,7 +1801,7 @@
//{
// mes.code = "300";
// mes.count = 0;
- // mes.Message = "鎿嶄綔澶辫触,褰撳墠鎶ュ伐浜х嚎搴斾负锛�" + da.Rows[0]["NAME"].ToString() + "!";
+ // mes.message = "鎿嶄綔澶辫触,褰撳墠鎶ュ伐浜х嚎搴斾负锛�" + da.Rows[0]["NAME"].ToString() + "!";
// mes.data = null;
// return mes;
//}
@@ -1729,14 +1915,14 @@
LogHelper.DbOperateLog(us.usercode, "鎶ュ伐", "鎶ュ伐浜嗗伐鍗�:" + mesordercode + "宸ュ簭:" + stepcode, us.usertype);
mes.code = "200";
mes.count = 0;
- mes.Message = "鎿嶄綔鎴愬姛!";
+ mes.message = "鎿嶄綔鎴愬姛!";
mes.data = null;
}
else
{
mes.code = "300";
mes.count = 0;
- mes.Message = "鎿嶄綔澶辫触!";
+ mes.message = "鎿嶄綔澶辫触!";
mes.data = null;
}
}
@@ -1744,7 +1930,7 @@
{
mes.code = "300";
mes.count = 0;
- mes.Message = e.Message;
+ mes.message = e.Message;
mes.data = null;
}
return mes;
@@ -1808,14 +1994,14 @@
LogHelper.DbOperateLog(us.usercode, "澶栧崗鍙戞枡", "澶栧崗鍙戞枡宸ュ崟:" + mesordercode + "宸ュ簭:" + stepcode, us.usertype);
mes.code = "200";
mes.count = 0;
- mes.Message = "鍙戞枡鎴愬姛!";
+ mes.message = "鍙戞枡鎴愬姛!";
mes.data = null;
}
else
{
mes.code = "300";
mes.count = 0;
- mes.Message = "鍙戞枡澶辫触!";
+ mes.message = "鍙戞枡澶辫触!";
mes.data = null;
}
}
@@ -1823,7 +2009,7 @@
{
mes.code = "300";
mes.count = 0;
- mes.Message = e.Message;
+ mes.message = e.Message;
mes.data = null;
}
return mes;
@@ -1881,7 +2067,7 @@
string wxstring = (string.Join(",", dr.Select(x => x.ToString()).ToArray()));
mes.code = "300";
mes.count = 0;
- mes.Message = "鎿嶄綔澶辫触,褰撳墠鏀舵枡澶栧崗渚涙柟涓庡彂鏂欏鍗忎緵搴斿晢涓嶅尮閰�,搴斾负锛氥��" + wxstring + "銆�!";
+ mes.message = "鎿嶄綔澶辫触,褰撳墠鏀舵枡澶栧崗渚涙柟涓庡彂鏂欏鍗忎緵搴斿晢涓嶅尮閰�,搴斾负锛氥��" + wxstring + "銆�!";
mes.data = null;
return mes;
}
@@ -1889,7 +2075,7 @@
{
mes.code = "300";
mes.count = 0;
- mes.Message = "鎿嶄綔澶辫触,褰撳墠鏀舵枡鏁伴噺+涓嶈壇鏁伴噺,涓嶈兘澶т簬鍙戞枡鏁伴噺:" + da.Rows[0]["FQTY"].ToString() + "!";
+ mes.message = "鎿嶄綔澶辫触,褰撳墠鏀舵枡鏁伴噺+涓嶈壇鏁伴噺,涓嶈兘澶т簬鍙戞枡鏁伴噺:" + da.Rows[0]["FQTY"].ToString() + "!";
mes.data = null;
return mes;
}
@@ -1897,7 +2083,7 @@
//{
// mes.code = "300";
// mes.count = 0;
- // mes.Message = "鎿嶄綔澶辫触,褰撳墠鏀舵枡澶栧崗渚涙柟搴斾负锛�" + da.Rows[0]["NAME"].ToString() + "!";
+ // mes.message = "鎿嶄綔澶辫触,褰撳墠鏀舵枡澶栧崗渚涙柟搴斾负锛�" + da.Rows[0]["NAME"].ToString() + "!";
// mes.data = null;
// return mes;
//}
@@ -1909,7 +2095,7 @@
{
mes.code = "300";
mes.count = 0;
- mes.Message = "鎿嶄綔澶辫触,褰撳墠鏀舵枡鏁伴噺+涓嶈壇鏁伴噺,涓嶈兘澶т簬寰呮敹鏁伴噺:" + (sum_fqty - sum_sqty) + "!";
+ mes.message = "鎿嶄綔澶辫触,褰撳墠鏀舵枡鏁伴噺+涓嶈壇鏁伴噺,涓嶈兘澶т簬寰呮敹鏁伴噺:" + (sum_fqty - sum_sqty) + "!";
mes.data = null;
return mes;
}
@@ -1987,14 +2173,14 @@
LogHelper.DbOperateLog(us.usercode, "澶栧崗鏀舵枡", "澶栧崗鏀舵枡宸ュ崟:" + mesordercode + "宸ュ簭:" + stepcode, us.usertype);
mes.code = "200";
mes.count = 0;
- mes.Message = "鏀舵垚鍔�!";
+ mes.message = "鏀舵垚鍔�!";
mes.data = null;
}
else
{
mes.code = "300";
mes.count = 0;
- mes.Message = "鏀舵枡澶辫触!";
+ mes.message = "鏀舵枡澶辫触!";
mes.data = null;
}
}
@@ -2002,7 +2188,7 @@
{
mes.code = "300";
mes.count = 0;
- mes.Message = e.Message;
+ mes.message = e.Message;
mes.data = null;
}
return mes;
@@ -2257,14 +2443,14 @@
LogHelper.DbOperateLog(us.usercode, "涓嶈壇澶勭悊", "宸ュ崟:" + json.Data.Rows[0]["WO_CODE"].ToString() + "宸ュ簭:" + json.Data.Rows[0]["STEP_CODE"].ToString(), us.usertype);
mes.code = "200";
mes.count = 0;
- mes.Message = "鎿嶄綔鎴愬姛!";
+ mes.message = "鎿嶄綔鎴愬姛!";
mes.data = null;
}
else
{
mes.code = "300";
mes.count = 0;
- mes.Message = "鎿嶄綔澶辫触!";
+ mes.message = "鎿嶄綔澶辫触!";
mes.data = null;
}
}
@@ -2272,7 +2458,7 @@
{
mes.code = "300";
mes.count = 0;
- mes.Message = e.Message;
+ mes.message = e.Message;
mes.data = null;
}
return mes;
@@ -2282,12 +2468,17 @@
#region[鐢熶骇鎵ц,鎶ュ伐璋冩暣鏁版嵁鏌ヨ鎺ュ彛]
- public static ToMessage MesOrderStepVerifySearch(string wo_code, string partnumber, string partname, string partspec, string reportuser, string reportdateopendate, string reportdateclosedate, int startNum, int endNum, string prop, string order)
+ public static ToMessage MesOrderStepVerifySearch(string wkshopcode, string wo_code, string partnumber, string partname, string partspec, string reportuser, string reportdateopendate, string reportdateclosedate, int startNum, int endNum, string prop, string order)
{
var dynamicParams = new DynamicParameters();
string search = "";
try
{
+ if (wkshopcode != "" && wkshopcode != null)
+ {
+ search += "and AA.wkshp_code=@wkshopcode ";
+ dynamicParams.Add("@wkshopcode", wkshopcode);
+ }
if (wo_code != "" && wo_code != null)
{
search += "and AA.wo_code like '%'+@wo_code+'%' ";
@@ -2328,47 +2519,48 @@
search = search.Substring(3);//鎴彇绱㈠紩2鍚庨潰鐨勫瓧绗�
// --------------鏌ヨ鎸囧畾鑷埗鎶ュ伐澶栧崗鏀舵枡鏁版嵁--------------
var total = 0; //鎬绘潯鏁�
- var sql = @" select * from(
- select A.id,B.id as sbid,A.wo_code,A.materiel_code as partnumber,P.partname,P.partspec,A.task_qty,M.wkshp_code,T.torg_name as wkshp_name,A.eqp_code,E.name as eqp_name,
- A.step_seq,A.step_code,S.stepname,S.flwtype as steptype,k.isbott as first_choke,k.isend as last_choke,A.step_price,B.reckway,B.usergroup_code,G.usergroupname as usergroup_name,
- B.report_person as usercode,
- STUFF((SELECT ',' + U.username
- FROM TUser U
- WHERE CHARINDEX(',' + U.usercode + ',', ',' + B.report_person + ',') > 0
- FOR XML PATH('')), 1, 1, '') AS username,
- B.report_date,B.report_qty,B.ng_qty,B.laborbad_qty,B.materielbad_qty
- from TK_Wrk_Record A
- 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 TK_Wrk_Step K on M.wo_code=K.wo_code and A.step_code=K.step_code
- left join TStep S on A.step_code=S.stepcode
- left join TMateriel_Info P on A.materiel_code=P.partcode
- left join TOrganization T on M.wkshp_code=T.torg_code
- left join TEqpInfo E on A.eqp_code=E.code
- left join TGroup G on G.usergroupcode=B.usergroup_code
- where A.style='B' and B.style='B' and M.status<>'CLOSED' and B.verify='N'
- union all
- select A.id,B.id as sbid,A.wo_code,A.materiel_code as partnumber,P.partname,P.partspec,M.plan_qty as task_qty,M.wkshp_code,T.torg_name as wkshp_name,A.wx_code as eqp_code,E.name as eqp_name,
- A.step_seq,A.step_code,S.stepname,S.flwtype as steptype,k.isbott as first_choke,k.isend as last_choke,A.step_price,'person' as reckway,'' as usergroup_code,'' as usergroup_name,
- B.in_person as usercode,
+ var sql = @"select * from(
+ select A.id,B.id as sbid,A.wo_code,A.materiel_code as partnumber,P.partname,P.partspec,A.task_qty,M.wkshp_code,T.torg_name as wkshp_name,A.eqp_code,E.name as eqp_name,
+ A.step_seq,A.step_code,S.stepname,S.flwtype as steptype,k.isbott as first_choke,k.isend as last_choke,A.step_price,B.reckway,B.usergroup_code,G.usergroupname as usergroup_name,
+ B.report_person as usercode,
STUFF((SELECT ',' + U.username
- FROM TUser U
- WHERE CHARINDEX(',' + U.usercode + ',', ',' + B.in_person + ',') > 0
- FOR XML PATH('')), 1, 1, '') AS username,
- B.in_time as report_date,B.sqty as report_qty,B.ng_qty,B.laborbad_qty,B.materielbad_qty
- from TK_Wrk_OutRecord A
- inner join TK_Wrk_OutRecordSub B on A.id = B.m_id
- left join TK_Wrk_Man M on A.wo_code = M.wo_code
- left join TK_Wrk_Step K on M.wo_code=K.wo_code and A.step_code=K.step_code
- left join TStep S on A.step_code = S.stepcode
- left join TMateriel_Info P on A.materiel_code = P.partcode
- left join TOrganization T on M.wkshp_code = T.torg_code
- left join TCustomer E on A.wx_code = E.code
- where A.style = 'S' and B.style = 'S' and M.status<>'CLOSED' and B.verify='N'
- ) as AA where" + search;
+ FROM TUser U
+ WHERE CHARINDEX(',' + U.usercode + ',', ',' + B.report_person + ',') > 0
+ FOR XML PATH('')), 1, 1, '') AS username,
+ B.report_date,B.report_qty,B.ng_qty,B.laborbad_qty,B.materielbad_qty,'' as wx_code,'' as wx_name
+ from TK_Wrk_Record A
+ 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 TK_Wrk_Step K on M.wo_code=K.wo_code and A.step_code=K.step_code
+ left join TStep S on A.step_code=S.stepcode
+ left join TMateriel_Info P on A.materiel_code=P.partcode
+ left join TOrganization T on M.wkshp_code=T.torg_code
+ left join TEqpInfo E on A.eqp_code=E.code
+ left join TGroup G on G.usergroupcode=B.usergroup_code
+ where A.style='B' and B.style='B' and M.status<>'CLOSED' and A.verify='N'
+ union all
+ select A.id,B.id as sbid,A.wo_code,A.materiel_code as partnumber,P.partname,P.partspec,M.plan_qty as task_qty,M.wkshp_code,T.torg_name as wkshp_name,A.wx_code as eqp_code,E.name as eqp_name,
+ A.step_seq,A.step_code,S.stepname,S.flwtype as steptype,k.isbott as first_choke,k.isend as last_choke,A.step_price,'person' as reckway,'' as usergroup_code,'' as usergroup_name,
+ B.in_person as usercode,
+ STUFF((SELECT ',' + U.username
+ FROM TUser U
+ WHERE CHARINDEX(',' + U.usercode + ',', ',' + B.in_person + ',') > 0
+ FOR XML PATH('')), 1, 1, '') AS username,
+ B.in_time as report_date,B.sqty as report_qty,B.ng_qty,B.laborbad_qty,B.materielbad_qty,A.wx_code,C.name as wx_name
+ from TK_Wrk_OutRecord A
+ inner join TK_Wrk_OutRecordSub B on A.id = B.m_id
+ left join TK_Wrk_Man M on A.wo_code = M.wo_code
+ left join TK_Wrk_Step K on M.wo_code=K.wo_code and A.step_code=K.step_code
+ left join TStep S on A.step_code = S.stepcode
+ left join TMateriel_Info P on A.materiel_code = P.partcode
+ left join TOrganization T on M.wkshp_code = T.torg_code
+ left join TCustomer E on A.wx_code = E.code
+ left join TCustomer C on A.wx_code=C.code
+ where A.style = 'S' and B.style = 'S' and M.status<>'CLOSED' and A.verify='N'
+ ) as AA where" + search;
var data = DapperHelper.GetPageList<object>(sql, dynamicParams, prop, order, startNum, endNum, out total);
mes.code = "200";
- mes.Message = "鏌ヨ鎴愬姛!";
+ mes.message = "鏌ヨ鎴愬姛!";
mes.count = total;
mes.data = data.ToList();
}
@@ -2376,7 +2568,7 @@
{
mes.code = "300";
mes.count = 0;
- mes.Message = e.Message;
+ mes.message = e.Message;
mes.data = null;
}
return mes;
@@ -2407,7 +2599,7 @@
var data = DapperHelper.selectdata(sql, dynamicParams);
mes.code = "200";
mes.count = 0;
- mes.Message = "鏌ヨ鎴愬姛!";
+ mes.message = "鏌ヨ鎴愬姛!";
mes.data = data;
}
@@ -2427,7 +2619,7 @@
var data = DapperHelper.selectdata(sql, dynamicParams);
mes.code = "200";
mes.count = 0;
- mes.Message = "鏌ヨ鎴愬姛!";
+ mes.message = "鏌ヨ鎴愬姛!";
mes.data = data;
}
}
@@ -2435,7 +2627,7 @@
{
mes.code = "300";
mes.count = 0;
- mes.Message = e.Message;
+ mes.message = e.Message;
mes.data = null;
}
return mes;
@@ -2457,6 +2649,20 @@
//鎺у埗閫昏緫锛氫腑闂村伐搴忚皟鏁�-> (鏈亾宸ュ簭褰撳墠璋冩暣鍚堟牸鏁�+鏈亾宸ュ簭闈炲綋鍓嶆姤宸ュ悎鏍兼�绘暟)<涓嬮亾宸ュ簭鎶ュ伐鎬绘暟(鍚堟牸+涓嶈壇+鎶ュ簾) ==涓嶈兘灏忎簬涓嬮亾鎶ュ伐鎬绘暟
string date = DateTime.Now.ToString(); //鑾峰彇绯荤粺鏃堕棿
list.Clear();
+ //鑾峰彇褰撳墠宸ュ簭涓婇亾宸ュ簭鍙婂睘鎬�
+ sql = @"select T.stepcode,T.stepname,T.flwtype from TK_Wrk_Step A
+ left join TStep T on A.step_code=T.stepcode
+ where A.wo_code=@ordercode and A.seq=@seq-1 ";
+ dynamicParams.Add("@ordercode", json[0].wo_code);
+ dynamicParams.Add("@seq", json[0].step_seq);
+ var pre = DapperHelper.selectdata(sql, dynamicParams);
+ //鑾峰彇褰撳墠宸ュ簭涓嬮亾宸ュ簭鍙婂睘鎬�
+ sql = @"select T.stepcode,T.stepname,T.flwtype from TK_Wrk_Step A
+ left join TStep T on A.step_code=T.stepcode
+ where A.wo_code=@ordercode and A.seq=@seq+1 ";
+ dynamicParams.Add("@ordercode", json[0].wo_code);
+ dynamicParams.Add("@seq", json[0].step_seq);
+ var next = DapperHelper.selectdata(sql, dynamicParams);
//鍒ゆ柇褰撳墠宸ュ簭鏄嚜鍒跺伐搴忚繕鏄鍗忓伐搴�
if (json[0].flw_type.ToString() == "Z")//鑷埗宸ュ簭
{
@@ -2488,34 +2694,65 @@
{
mes.code = "300";
mes.count = 0;
- mes.Message = "褰撳墠棣栭亾宸ュ簭淇敼鎶ュ伐鎬绘暟閲忥細銆�" + updatereportsumqty + "銆戜笉鑳藉ぇ浜庡伐鍗曚换鍔℃暟閲忥細銆�" + json[0].task_qty.ToString() + "銆�!";
+ mes.message = "褰撳墠棣栭亾宸ュ簭淇敼鎶ュ伐鎬绘暟閲忥細銆�" + updatereportsumqty + "銆戜笉鑳藉ぇ浜庡伐鍗曚换鍔℃暟閲忥細銆�" + json[0].task_qty.ToString() + "銆�!";
mes.data = null;
return mes;
}
- //鏌ヨ褰撳墠宸ュ簭涓嬮亾宸ュ簭锛氭�绘姤宸ユ暟閲忋�佹�讳笉鑹暟閲忋�佹�绘姤搴熸暟閲�
- sql = @"select isnull(sum(good_qty),0) as good_qty,isnull(sum(ng_qty),0) as ng_qty,isnull(sum(laborbad_qty),0) as laborbad_qty,isnull(sum(materielbad_qty),0) as materielbad_qty
- from TK_Wrk_Record where wo_code=@wo_code and style='B' and step_seq=@step_seq+1";
- dynamicParams.Add("@wo_code", json[0].wo_code);
- dynamicParams.Add("@step_seq", json[0].step_seq);
- var dt0 = DapperHelper.selectdata(sql, dynamicParams);
- if (dt0.Rows.Count > 0)
+ //鍒ゆ柇鏄惁瀛樺湪涓嬮亾宸ュ簭鍙婂睘鎬�
+ if (next.Rows.Count > 0)
{
- //鍒ゆ柇褰撳墠宸ュ簭锛氭姤宸ユ�绘暟鏁伴噺+涓嶈壇鎬绘暟鏁伴噺+宸ュ簾鎬绘暟閲�+鏂欏簾鎬绘暟閲�<涓嬮亾宸ュ簭鎶ュ伐鎬绘暟閲�+涓嬮亾宸ュ簭涓嶈壇鎬绘暟閲�+涓嬮亾宸ュ簭宸ュ簾鎬绘暟閲�+涓嬮亾宸ュ簭鏂欏簾鎬绘暟閲�
- decimal last_reportqty = decimal.Parse(dt0.Rows[0]["good_qty"].ToString()); //涓嬮亾宸ュ簭鎶ュ伐鎬绘暟閲�
- decimal last_ngqty = decimal.Parse(dt0.Rows[0]["ng_qty"].ToString()); //涓嬮亾宸ュ簭涓嶈壇鎬绘暟閲�
- decimal last_laborbad_qty = decimal.Parse(dt0.Rows[0]["laborbad_qty"].ToString()); //涓嬮亾宸ュ簭宸ュ簾鎬绘暟閲�
- decimal last_materielbad_qty = decimal.Parse(dt0.Rows[0]["materielbad_qty"].ToString()); //涓嬮亾宸ュ簭鏂欏簾鎬绘暟閲�
- decimal last_updatereportsumqty = last_reportqty + last_ngqty + last_laborbad_qty + last_materielbad_qty;
- //鍒ゆ柇锛堝綋鍓嶉潪鏈鎶ュ伐鎬诲悎鏍兼暟+鏈鎶ュ伐璋冩暣鍚堟牸鏁帮級<涓嬮亾宸ュ簭鎶ュ伐鎬绘暟
- if ((notthis_reportqty + decimal.Parse(json[0].report_qty) < last_updatereportsumqty))
+ if (next.Rows[0]["flwtype"].ToString() == "Z")
{
- mes.code = "300";
- mes.count = 0;
- mes.Message = "褰撳墠棣栭亾宸ュ簭淇敼鎶ュ伐鎬诲悎鏍兼暟閲忥細銆�" + (notthis_reportqty + decimal.Parse(json[0].report_qty)) + "銆戜笉鑳藉皬浜庝笅閬撳伐搴忔姤宸ユ�绘暟閲忥細銆�" + last_updatereportsumqty + "銆�,璇疯緭鍏ュ悎娉曟暟鍊兼垨鍏堜慨鏀逛笅閬撳伐搴忔姤宸ユ暟閲�!";
- mes.data = null;
- return mes;
+ //鏌ヨ褰撳墠宸ュ簭涓嬮亾宸ュ簭锛氭�绘姤宸ユ暟閲忋�佹�讳笉鑹暟閲忋�佹�绘姤搴熸暟閲�
+ sql = @"select isnull(sum(good_qty),0) as good_qty,isnull(sum(ng_qty),0) as ng_qty,isnull(sum(laborbad_qty),0) as laborbad_qty,isnull(sum(materielbad_qty),0) as materielbad_qty
+ from TK_Wrk_Record where wo_code=@wo_code and style='B' and step_seq=@step_seq+1";
+ dynamicParams.Add("@wo_code", json[0].wo_code);
+ dynamicParams.Add("@step_seq", json[0].step_seq);
+ var dt0 = DapperHelper.selectdata(sql, dynamicParams);
+ if (dt0.Rows.Count > 0)
+ {
+ //鍒ゆ柇褰撳墠宸ュ簭锛氭姤宸ユ�绘暟鏁伴噺+涓嶈壇鎬绘暟鏁伴噺+宸ュ簾鎬绘暟閲�+鏂欏簾鎬绘暟閲�<涓嬮亾宸ュ簭鎶ュ伐鎬绘暟閲�+涓嬮亾宸ュ簭涓嶈壇鎬绘暟閲�+涓嬮亾宸ュ簭宸ュ簾鎬绘暟閲�+涓嬮亾宸ュ簭鏂欏簾鎬绘暟閲�
+ decimal last_reportqty = decimal.Parse(dt0.Rows[0]["good_qty"].ToString()); //涓嬮亾宸ュ簭鎶ュ伐鎬绘暟閲�
+ decimal last_ngqty = decimal.Parse(dt0.Rows[0]["ng_qty"].ToString()); //涓嬮亾宸ュ簭涓嶈壇鎬绘暟閲�
+ decimal last_laborbad_qty = decimal.Parse(dt0.Rows[0]["laborbad_qty"].ToString()); //涓嬮亾宸ュ簭宸ュ簾鎬绘暟閲�
+ decimal last_materielbad_qty = decimal.Parse(dt0.Rows[0]["materielbad_qty"].ToString()); //涓嬮亾宸ュ簭鏂欏簾鎬绘暟閲�
+ decimal last_updatereportsumqty = last_reportqty + last_ngqty + last_laborbad_qty + last_materielbad_qty;
+ //鍒ゆ柇锛堝綋鍓嶉潪鏈鎶ュ伐鎬诲悎鏍兼暟+鏈鎶ュ伐璋冩暣鍚堟牸鏁帮級<涓嬮亾宸ュ簭鎶ュ伐鎬绘暟
+ if ((notthis_reportqty + this_reportqty) < last_updatereportsumqty)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "褰撳墠棣栭亾宸ュ簭淇敼鎶ュ伐鎬诲悎鏍兼暟閲忥細銆�" + (notthis_reportqty + this_reportqty) + "銆戜笉鑳藉皬浜庝笅閬撹嚜鍒跺伐搴忔姤宸ユ�绘暟閲忥細銆�" + last_updatereportsumqty + "銆�!";
+ mes.data = null;
+ return mes;
+ }
+ }
+ }
+ else
+ {
+ //鏌ヨ褰撳墠宸ュ簭涓嬮亾宸ュ簭锛氭�诲彂鏂欐暟閲�
+ sql = @"select isnull(sum(fqty),0) as good_qty
+ from TK_Wrk_OutRecord where wo_code=@wo_code and style='S' and step_seq=@step_seq+1";
+ dynamicParams.Add("@wo_code", json[0].wo_code);
+ dynamicParams.Add("@step_seq", json[0].step_seq);
+ var dt0 = DapperHelper.selectdata(sql, dynamicParams);
+ if (dt0.Rows.Count > 0)
+ {
+ //鍒ゆ柇褰撳墠宸ュ簭锛氬彂鏂欐�绘暟鏁伴噺
+ decimal last_reportqty = decimal.Parse(dt0.Rows[0]["good_qty"].ToString()); //涓嬮亾宸ュ簭鍙戞枡鎬绘暟閲�
+ //鍒ゆ柇锛堝綋鍓嶉潪鏈鎶ュ伐鎬诲悎鏍兼暟+鏈鎶ュ伐璋冩暣鍚堟牸鏁帮級<涓嬮亾宸ュ簭鍙戞枡鎬绘暟
+ if ((notthis_reportqty + this_reportqty) < last_reportqty)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "褰撳墠棣栭亾宸ュ簭淇敼鎶ュ伐鎬诲悎鏍兼暟閲忥細銆�" + (notthis_reportqty + this_reportqty) + "銆戜笉鑳藉皬浜庝笅閬撳鍗忓伐搴忓彂鏂欐�绘暟閲忥細銆�" + last_reportqty + "銆�!";
+ mes.data = null;
+ return mes;
+ }
+ }
}
}
+
}
//鏈亾宸ュ簭鐨勬姤宸�
else if (json[0].last_choke == "Y")
@@ -2534,33 +2771,63 @@
//鑾峰彇褰撳墠鏈亾宸ュ簭鎶ュ伐鎬绘暟閲忥細鏈淇敼鎶ュ伐鏁伴噺+鏈淇敼涓嶈壇鏁伴噺+鏈淇敼宸ュ簾鏁伴噺+鏈淇敼鎶ュ伐鏂欏簾鏁伴噺+褰撳墠鏈亾宸ュ簭闈炴湰娆℃姤宸ユ�绘暟+褰撳墠鏈亾宸ュ簭闈炴湰娆′笉鑹�绘暟+褰撳墠鏈亾宸ュ簭闈炴湰娆″伐搴熸�绘暟+褰撳墠鏈亾宸ュ簭闈炴湰娆℃枡搴熸�绘暟
decimal updatereportsumqty = this_reportqty + this_ngqty + this_laborbadqty + this_materielbadqty + notthis_reportqty + notthis_ngqty + notthis_laborbad_qty + notthis_materielbad_qty;
- //鏌ヨ褰撳墠鏈亾宸ュ簭涓婇亾宸ュ簭锛氭�绘姤宸ユ暟閲忋�佹�讳笉鑹暟閲忋�佹�绘姤搴熸暟閲�
- sql = @"select isnull(sum(good_qty),0) as good_qty,isnull(sum(ng_qty),0) as ng_qty,isnull(sum(laborbad_qty),0) as laborbad_qty,isnull(sum(materielbad_qty),0) as materielbad_qty
- from TK_Wrk_Record where wo_code=@wo_code and style='B' and step_seq=@step_seq-1";
- dynamicParams.Add("@wo_code", json[0].wo_code);
- dynamicParams.Add("@step_seq", json[0].step_seq);
- var dt0 = DapperHelper.selectdata(sql, dynamicParams);
- if (dt0.Rows.Count > 0)
+ //鍒ゆ柇鏄惁瀛樺湪涓婇亾宸ュ簭鍙婂睘鎬�
+ if (pre.Rows.Count > 0)
{
- decimal last_reportqty = decimal.Parse(dt0.Rows[0]["good_qty"].ToString()); //涓婇亾宸ュ簭鎶ュ伐鎬绘暟閲�
- decimal last_ngqty = decimal.Parse(dt0.Rows[0]["ng_qty"].ToString()); //涓婇亾宸ュ簭涓嶈壇鎬绘暟閲�
- decimal last_laborbad_qty = decimal.Parse(dt0.Rows[0]["laborbad_qty"].ToString()); //涓婇亾宸ュ簭宸ュ簾鎬绘暟閲�
- decimal last_materielbad_qty = decimal.Parse(dt0.Rows[0]["materielbad_qty"].ToString()); //涓婇亾宸ュ簭鏂欏簾鎬绘暟閲�
- decimal last_updatereportsumqty = last_reportqty + last_ngqty + last_laborbad_qty + last_materielbad_qty;
- //鍒ゆ柇锛氬綋鍓嶆湯閬撳伐搴忔姤宸ヨ褰曪細褰撳墠鏈亾宸ュ簭鎶ュ伐鎬绘暟閲�>涓婇亾宸ュ簭鎶ュ伐鍚堟牸鎬绘暟
- if (updatereportsumqty > last_reportqty)
+ if (pre.Rows[0]["flwtype"].ToString() == "Z")
{
- mes.code = "300";
- mes.count = 0;
- mes.Message = "褰撳墠鏈亾宸ュ簭淇敼鎶ュ伐鎬绘暟閲忥細銆�" + updatereportsumqty + "銆戜笉鑳藉ぇ浜庝笂閬撳伐搴忔姤宸ユ�诲悎鏍兼暟閲忥細銆�" + last_reportqty + "銆�,璇疯緭鍏ュ悎娉曟暟鍊兼垨鍏堜慨鏀逛笂閬撳伐搴忔姤宸ユ暟閲�!";
- mes.data = null;
- return mes;
+ //鏌ヨ褰撳墠鏈亾宸ュ簭涓婇亾宸ュ簭锛氭�绘姤宸ユ暟閲忋�佹�讳笉鑹暟閲忋�佹�绘姤搴熸暟閲�
+ sql = @"select isnull(sum(good_qty),0) as good_qty,isnull(sum(ng_qty),0) as ng_qty,isnull(sum(laborbad_qty),0) as laborbad_qty,isnull(sum(materielbad_qty),0) as materielbad_qty
+ from TK_Wrk_Record where wo_code=@wo_code and style='B' and step_seq=@step_seq-1";
+ dynamicParams.Add("@wo_code", json[0].wo_code);
+ dynamicParams.Add("@step_seq", json[0].step_seq);
+ var dt0 = DapperHelper.selectdata(sql, dynamicParams);
+ if (dt0.Rows.Count > 0)
+ {
+ decimal last_reportqty = decimal.Parse(dt0.Rows[0]["good_qty"].ToString()); //涓婇亾宸ュ簭鎶ュ伐鎬绘暟閲�
+ decimal last_ngqty = decimal.Parse(dt0.Rows[0]["ng_qty"].ToString()); //涓婇亾宸ュ簭涓嶈壇鎬绘暟閲�
+ decimal last_laborbad_qty = decimal.Parse(dt0.Rows[0]["laborbad_qty"].ToString()); //涓婇亾宸ュ簭宸ュ簾鎬绘暟閲�
+ decimal last_materielbad_qty = decimal.Parse(dt0.Rows[0]["materielbad_qty"].ToString()); //涓婇亾宸ュ簭鏂欏簾鎬绘暟閲�
+ decimal last_updatereportsumqty = last_reportqty + last_ngqty + last_laborbad_qty + last_materielbad_qty;
+ //鍒ゆ柇锛氬綋鍓嶆湯閬撳伐搴忔姤宸ヨ褰曪細褰撳墠鏈亾宸ュ簭鎶ュ伐鎬绘暟閲�>涓婇亾宸ュ簭鎶ュ伐鍚堟牸鎬绘暟
+ if (updatereportsumqty > last_reportqty)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "褰撳墠鏈亾宸ュ簭淇敼鎶ュ伐鎬绘暟閲忥細銆�" + updatereportsumqty + "銆戜笉鑳藉ぇ浜庝笂閬撳伐搴忔姤宸ユ�诲悎鏍兼暟閲忥細銆�" + last_reportqty + "銆�!";
+ mes.data = null;
+ return mes;
+ }
+ }
+ }
+ else
+ {
+ //鏌ヨ褰撳墠宸ュ簭涓婇亾宸ュ簭锛氭�绘敹鏂欐暟閲�
+ sql = @"select isnull(sum(sqty),0) as good_qty
+ from TK_Wrk_OutRecord where wo_code=@wo_code and style='S' and step_seq=@step_seq-1";
+ dynamicParams.Add("@wo_code", json[0].wo_code);
+ dynamicParams.Add("@step_seq", json[0].step_seq);
+ var dt0 = DapperHelper.selectdata(sql, dynamicParams);
+ if (dt0.Rows.Count > 0)
+ {
+ //鍒ゆ柇褰撳墠宸ュ簭锛氭敹鏂欐�绘暟鏁伴噺
+ decimal last_reportqty = decimal.Parse(dt0.Rows[0]["good_qty"].ToString()); //涓嬮亾宸ュ簭鍙戞枡鎬绘暟閲�
+ //鍒ゆ柇锛氬綋鍓嶆湯閬撳伐搴忔姤宸ヨ褰曪細褰撳墠鏈亾宸ュ簭鎶ュ伐鎬绘暟閲�>涓婇亾宸ュ簭鏀舵枡鍚堟牸鎬绘暟
+ if (updatereportsumqty > last_reportqty)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "褰撳墠鏈亾宸ュ簭淇敼鎶ュ伐鎬绘暟閲忥細銆�" + updatereportsumqty + "銆戜笉鑳藉ぇ浜庝笂閬撳伐搴忔敹鏂欐�诲悎鏍兼暟閲忥細銆�" + last_reportqty + "銆�!";
+ mes.data = null;
+ return mes;
+ }
+ }
}
}
}
else //涓棿宸ュ簭鐨勬姤宸�
{
- //鏌ヨ褰撳墠涓棿鎶ュ伐宸ュ簭闈炴娆℃姤宸ワ細鎬绘姤宸ユ暟閲忋�佹�讳笉鑹暟閲忋�佹�绘姤搴熸暟閲�
+ //鏌ヨ褰撳墠涓棿鎶ュ伐宸ュ簭闈炴娆℃姤宸ワ細鎬绘姤宸ユ暟閲忋�佹�讳笉鑹暟閲忋�佹�绘姤搴熸暟閲�
sql = @"select isnull(sum(good_qty),0) as good_qty,isnull(sum(ng_qty),0) as ng_qty,isnull(sum(laborbad_qty),0) as laborbad_qty,isnull(sum(materielbad_qty),0) as materielbad_qty
from TK_Wrk_Record where wo_code=@wo_code and style='B' and id<>@id and step_code=@step_code";
dynamicParams.Add("@wo_code", json[0].wo_code);
@@ -2573,50 +2840,111 @@
decimal notthis_materielbad_qty = decimal.Parse(dt.Rows[0]["materielbad_qty"].ToString()); //褰撳墠宸ュ簭闈炴湰娆℃姤宸ユ枡搴熸�绘暟
//鑾峰彇褰撳墠涓棿宸ュ簭鎶ュ伐鎬绘暟閲忥細鏈淇敼鎶ュ伐鏁伴噺+鏈淇敼涓嶈壇鏁伴噺+鏈淇敼宸ュ簾鏁伴噺+鏈淇敼鏂欏簾鎬绘暟+褰撳墠宸ュ簭闈炴湰娆℃姤宸ユ�绘暟+褰撳墠宸ュ簭闈炴湰娆′笉鑹�绘暟+褰撳墠宸ュ簭闈炴湰娆″伐搴熸�绘暟+褰撳墠宸ュ簭闈炴湰娆℃枡搴熸�绘暟
decimal updatereportsumqty = this_reportqty + this_ngqty + this_laborbadqty + this_materielbadqty + notthis_reportqty + notthis_ngqty + notthis_laborbad_qty + notthis_materielbad_qty;
- //鏌ヨ褰撳墠宸ュ簭涓婇亾宸ュ簭锛氭�绘姤宸ユ暟閲忋�佹�讳笉鑹暟閲忋�佹�诲伐搴熸暟閲忋�佹�绘枡搴熸暟閲�
- sql = @"select isnull(sum(good_qty),0) as good_qty,isnull(sum(ng_qty),0) as ng_qty,isnull(sum(laborbad_qty),0) as laborbad_qty,isnull(sum(materielbad_qty),0) as materielbad_qty
- from TK_Wrk_Record where wo_code=@wo_code and style='B' and step_seq=@step_seq-1";
- dynamicParams.Add("@wo_code", json[0].wo_code);
- dynamicParams.Add("@step_seq", json[0].step_seq);
- var dt0 = DapperHelper.selectdata(sql, dynamicParams);
- if (dt0.Rows.Count > 0)
+
+ //鍒ゆ柇鏄惁瀛樺湪涓婇亾宸ュ簭鍙婂睘鎬�
+ if (pre.Rows.Count > 0)
{
- decimal last_reportqty = decimal.Parse(dt0.Rows[0]["good_qty"].ToString()); //涓婇亾宸ュ簭鎶ュ伐鎬诲悎鏍兼暟閲�
- decimal last_ngqty = decimal.Parse(dt0.Rows[0]["ng_qty"].ToString()); //涓婇亾宸ュ簭涓嶈壇鎬绘暟閲�
- decimal last_laborbad_qty = decimal.Parse(dt0.Rows[0]["laborbad_qty"].ToString()); //涓婇亾宸ュ簭宸ュ簾鎬绘暟閲�
- decimal last_materielbad_qty = decimal.Parse(dt0.Rows[0]["materielbad_qty"].ToString());//涓婇亾宸ュ簭鏂欏簾鎬绘暟閲�
- decimal last_updatereportsumqty = last_reportqty + last_ngqty + last_laborbad_qty + last_materielbad_qty;
- //鍒ゆ柇锛氬綋鍓嶅伐搴忔姤宸ヨ褰曪細褰撳墠宸ュ簭鎶ュ伐鎬绘暟>涓婇亾宸ュ簭鎶ュ伐鎬诲悎鏍兼暟
- if (updatereportsumqty > last_reportqty)
+ if (pre.Rows[0]["flwtype"].ToString() == "Z")
{
- mes.code = "300";
- mes.count = 0;
- mes.Message = "褰撳墠宸ュ簭淇敼鎶ュ伐鎬绘暟閲忥細銆�" + updatereportsumqty + "銆戜笉鑳藉ぇ浜庝笂閬撳伐搴忔姤宸ユ�诲悎鏍兼暟閲忥細銆�" + last_reportqty + "銆�,璇疯緭鍏ュ悎娉曟暟鍊兼垨鍏堜慨鏀逛笂閬撳伐搴忔姤宸ユ暟閲�!";
- mes.data = null;
- return mes;
+ //鏌ヨ褰撳墠宸ュ簭涓婇亾宸ュ簭锛氭�绘姤宸ユ暟閲忋�佹�讳笉鑹暟閲忋�佹�诲伐搴熸暟閲忋�佹�绘枡搴熸暟閲�
+ sql = @"select isnull(sum(good_qty),0) as good_qty,isnull(sum(ng_qty),0) as ng_qty,isnull(sum(laborbad_qty),0) as laborbad_qty,isnull(sum(materielbad_qty),0) as materielbad_qty
+ from TK_Wrk_Record where wo_code=@wo_code and style='B' and step_seq=@step_seq-1";
+ dynamicParams.Add("@wo_code", json[0].wo_code);
+ dynamicParams.Add("@step_seq", json[0].step_seq);
+ var dt0 = DapperHelper.selectdata(sql, dynamicParams);
+ if (dt0.Rows.Count > 0)
+ {
+ decimal last_reportqty = decimal.Parse(dt0.Rows[0]["good_qty"].ToString()); //涓婇亾宸ュ簭鎶ュ伐鎬诲悎鏍兼暟閲�
+ decimal last_ngqty = decimal.Parse(dt0.Rows[0]["ng_qty"].ToString()); //涓婇亾宸ュ簭涓嶈壇鎬绘暟閲�
+ decimal last_laborbad_qty = decimal.Parse(dt0.Rows[0]["laborbad_qty"].ToString()); //涓婇亾宸ュ簭宸ュ簾鎬绘暟閲�
+ decimal last_materielbad_qty = decimal.Parse(dt0.Rows[0]["materielbad_qty"].ToString());//涓婇亾宸ュ簭鏂欏簾鎬绘暟閲�
+ decimal last_updatereportsumqty = last_reportqty + last_ngqty + last_laborbad_qty + last_materielbad_qty;
+ //鍒ゆ柇锛氬綋鍓嶅伐搴忔姤宸ヨ褰曪細褰撳墠宸ュ簭鎶ュ伐鎬绘暟>涓婇亾宸ュ簭鎶ュ伐鎬诲悎鏍兼暟
+ if (updatereportsumqty > last_reportqty)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "褰撳墠宸ュ簭淇敼鎶ュ伐鎬绘暟閲忥細銆�" + updatereportsumqty + "銆戜笉鑳藉ぇ浜庝笂閬撳伐搴忔姤宸ユ�诲悎鏍兼暟閲忥細銆�" + last_reportqty + "銆�!";
+ mes.data = null;
+ return mes;
+ }
+ }
+ }
+ else
+ {
+ //鏌ヨ褰撳墠宸ュ簭涓婇亾宸ュ簭锛氭�绘敹鏂欐暟閲�
+ sql = @"select isnull(sum(sqty),0) as good_qty
+ from TK_Wrk_OutRecord where wo_code=@wo_code and style='S' and step_seq=@step_seq-1";
+ dynamicParams.Add("@wo_code", json[0].wo_code);
+ dynamicParams.Add("@step_seq", json[0].step_seq);
+ var dt0 = DapperHelper.selectdata(sql, dynamicParams);
+ if (dt0.Rows.Count > 0)
+ {
+ //鍒ゆ柇褰撳墠宸ュ簭锛氭敹鏂欐�绘暟鏁伴噺
+ decimal last_reportqty = decimal.Parse(dt0.Rows[0]["good_qty"].ToString()); //涓婇亾宸ュ簭鏀舵枡鎬诲悎鏍兼暟閲�
+ //鍒ゆ柇锛氬綋鍓嶆湯閬撳伐搴忔姤宸ヨ褰曪細褰撳墠宸ュ簭鎶ュ伐鎬绘暟閲�>涓婇亾宸ュ簭鏀舵枡鎬诲悎鏍兼暟閲�
+ if (updatereportsumqty > last_reportqty)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "褰撳墠宸ュ簭淇敼鎶ュ伐鎬绘暟閲忥細銆�" + updatereportsumqty + "銆戜笉鑳藉ぇ浜庝笂閬撳伐搴忔敹鏂欐�诲悎鏍兼暟閲忥細銆�" + last_reportqty + "銆�!";
+ mes.data = null;
+ return mes;
+ }
+ }
}
}
- //鏌ヨ褰撳墠宸ュ簭涓嬮亾宸ュ簭锛氭�绘姤宸ユ暟閲忋�佹�讳笉鑹暟閲忋�佹�绘姤搴熸暟閲�
- sql = @"select isnull(sum(good_qty),0) as good_qty,isnull(sum(ng_qty),0) as ng_qty,isnull(sum(laborbad_qty),0) as laborbad_qty,isnull(sum(materielbad_qty),0) as materielbad_qty
- from TK_Wrk_Record where wo_code=@wo_code and style='B' and step_seq=@step_seq+1";
- dynamicParams.Add("@wo_code", json[0].wo_code);
- dynamicParams.Add("@step_seq", json[0].step_seq);
- var dt1 = DapperHelper.selectdata(sql, dynamicParams);
- if (dt1.Rows.Count > 0)
+ //鍒ゆ柇鏄惁瀛樺湪涓嬮亾宸ュ簭灞炴��
+ if (next.Rows.Count > 0)
{
- decimal last_reportqty = decimal.Parse(dt1.Rows[0]["good_qty"].ToString()); //涓嬮亾宸ュ簭鎶ュ伐鎬绘暟閲�
- decimal last_ngqty = decimal.Parse(dt1.Rows[0]["ng_qty"].ToString()); //涓嬮亾宸ュ簭涓嶈壇鎬绘暟閲�
- decimal last_laborbad_qty = decimal.Parse(dt1.Rows[0]["laborbad_qty"].ToString()); //涓嬮亾宸ュ簭宸ュ簾鎬绘暟閲�
- decimal last_materielbad_qty = decimal.Parse(dt1.Rows[0]["materielbad_qty"].ToString()); //涓嬮亾宸ュ簭鏂欏簾鎬绘暟閲�
- decimal last_updatereportsumqty = last_reportqty + last_ngqty + last_laborbad_qty + last_materielbad_qty;
- //鍒ゆ柇锛堝綋鍓嶉潪鏈鎶ュ伐鎬诲悎鏍兼暟+鏈鎶ュ伐璋冩暣鍚堟牸鏁帮級<涓嬮亾宸ュ簭鎶ュ伐鎬绘暟
- if ((notthis_reportqty + decimal.Parse(json[0].report_qty)< last_updatereportsumqty))
+ if (next.Rows[0]["flwtype"].ToString() == "Z")
{
- mes.code = "300";
- mes.count = 0;
- mes.Message = "褰撳墠宸ュ簭淇敼鎶ュ伐鎬诲悎鏍兼暟閲忥細銆�" + (notthis_reportqty + decimal.Parse(json[0].report_qty)) + "銆戜笉鑳藉皬浜庝笅閬撳伐搴忔姤宸ユ�绘暟閲忥細銆�" + last_updatereportsumqty + "銆�,璇疯緭鍏ュ悎娉曟暟鍊兼垨鍏堜慨鏀逛笅閬撳伐搴忔姤宸ユ暟閲�!";
- mes.data = null;
- return mes;
+ //鏌ヨ褰撳墠宸ュ簭涓嬮亾宸ュ簭锛氭�绘姤宸ユ暟閲忋�佹�讳笉鑹暟閲忋�佹�绘姤搴熸暟閲�
+ sql = @"select isnull(sum(good_qty),0) as good_qty,isnull(sum(ng_qty),0) as ng_qty,isnull(sum(laborbad_qty),0) as laborbad_qty,isnull(sum(materielbad_qty),0) as materielbad_qty
+ from TK_Wrk_Record where wo_code=@wo_code and style='B' and step_seq=@step_seq+1";
+ dynamicParams.Add("@wo_code", json[0].wo_code);
+ dynamicParams.Add("@step_seq", json[0].step_seq);
+ var dt1 = DapperHelper.selectdata(sql, dynamicParams);
+ if (dt1.Rows.Count > 0)
+ {
+ decimal last_reportqty = decimal.Parse(dt1.Rows[0]["good_qty"].ToString()); //涓嬮亾宸ュ簭鎶ュ伐鎬绘暟閲�
+ decimal last_ngqty = decimal.Parse(dt1.Rows[0]["ng_qty"].ToString()); //涓嬮亾宸ュ簭涓嶈壇鎬绘暟閲�
+ decimal last_laborbad_qty = decimal.Parse(dt1.Rows[0]["laborbad_qty"].ToString()); //涓嬮亾宸ュ簭宸ュ簾鎬绘暟閲�
+ decimal last_materielbad_qty = decimal.Parse(dt1.Rows[0]["materielbad_qty"].ToString()); //涓嬮亾宸ュ簭鏂欏簾鎬绘暟閲�
+ decimal last_updatereportsumqty = last_reportqty + last_ngqty + last_laborbad_qty + last_materielbad_qty;
+ //鍒ゆ柇锛堝綋鍓嶉潪鏈鎶ュ伐鎬诲悎鏍兼暟+鏈鎶ュ伐璋冩暣鍚堟牸鏁帮級<涓嬮亾宸ュ簭鎶ュ伐鎬绘暟
+ if ((notthis_reportqty + this_reportqty) < last_updatereportsumqty)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "褰撳墠宸ュ簭淇敼鎶ュ伐鎬诲悎鏍兼暟閲忥細銆�" + (notthis_reportqty + this_reportqty) + "銆戜笉鑳藉皬浜庝笅閬撳伐搴忔姤宸ユ�绘暟閲忥細銆�" + last_updatereportsumqty + "銆�!";
+ mes.data = null;
+ return mes;
+ }
+ }
+ }
+ else
+ {
+ //鏌ヨ褰撳墠宸ュ簭涓嬮亾宸ュ簭锛氭�诲彂鏂欐暟閲�
+ sql = @"select isnull(sum(fqty),0) as good_qty
+ from TK_Wrk_OutRecord where wo_code=@wo_code and style='F' and step_seq=@step_seq+1";
+ dynamicParams.Add("@wo_code", json[0].wo_code);
+ dynamicParams.Add("@step_seq", json[0].step_seq);
+ var dt0 = DapperHelper.selectdata(sql, dynamicParams);
+ if (dt0.Rows.Count > 0)
+ {
+ //鍒ゆ柇褰撳墠宸ュ簭锛氬彂鏂欐�绘暟鏁伴噺
+ decimal last_reportqty = decimal.Parse(dt0.Rows[0]["good_qty"].ToString()); //涓嬮亾宸ュ簭鍙戞枡鎬诲悎鏍兼暟閲�
+ //鍒ゆ柇锛堝綋鍓嶉潪鏈鎶ュ伐鎬诲悎鏍兼暟+鏈鎶ュ伐璋冩暣鍚堟牸鏁帮級<涓嬮亾宸ュ簭鍙戞枡鎬绘暟
+ if ((notthis_reportqty + this_reportqty) < last_reportqty)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "褰撳墠宸ュ簭淇敼鎶ュ伐鎬绘暟閲忥細銆�" + (notthis_reportqty + this_reportqty) + "銆戜笉鑳藉ぇ浜庝笅閬撳伐搴忓彂鏂欐�绘暟閲忥細銆�" + last_reportqty + "銆�!";
+ mes.data = null;
+ return mes;
+ }
+ }
}
}
}
@@ -2644,7 +2972,8 @@
}
});
//鍥炲啓瀵瑰簲鐨勬姤宸ヨ褰曚富琛ㄥ悎鏍兼暟閲忋�佷笉鑹暟閲忋�佹姤搴熸暟閲�
- sql = @"update TK_Wrk_Record set start_qty=start_qty+@good_qty, good_qty=good_qty+@good_qty,ng_qty=ng_qty+@ng_qty,laborbad_qty=laborbad_qty+@laborbad_qty,materielbad_qty=materielbad_qty+@materielbad_qty
+ sql = @"update TK_Wrk_Record set start_qty=start_qty+@good_qty, good_qty=good_qty+@good_qty,ng_qty=ng_qty+@ng_qty,laborbad_qty=laborbad_qty+@laborbad_qty,materielbad_qty=materielbad_qty+@materielbad_qty,
+ updatereportuser=@updatereportuser,updatereportdate=@updatereportdate
where wo_code=@wo_code and step_code=@step_code and id=@id and style='B'";
list.Add(new
{
@@ -2657,7 +2986,9 @@
materielbad_qty = this_materielbad_dvalue,
wo_code = json[0].wo_code,
step_code = json[0].step_code,
- id = int.Parse(json[0].id)
+ id = int.Parse(json[0].id),
+ updatereportuser = us.usercode,
+ updatereportdate = date
}
});
//鍥炲啓宸ュ崟宸ュ簭琛�
@@ -2676,7 +3007,7 @@
step_code = json[0].step_code
}
});
-
+
for (int i = 0; i < json[0].children.Count; i++)
{
//鍥炲啓涓嶈壇
@@ -2720,173 +3051,225 @@
}
if (json[0].flw_type.ToString() == "W")//澶栧崗宸ュ簭
{
- //鑾峰彇姝ゆ鎶ュ伐璋冩暣鎻愪氦鐨勬暟鎹�(鍚堟牸鏁伴噺銆佷笉鑹暟閲忋�佸伐搴熸暟閲忋�佹枡搴熸暟閲�)
- decimal this_reportqty = decimal.Parse(json[0].report_qty.ToString()); //鎶ュ伐鏁伴噺(鍚堟牸)
+ //鏌ヨ褰撳墠棣栭亾宸ュ簭闈炴娆′緵搴斿晢鏀舵枡锛氭�绘敹鏂欐暟閲�
+ sql = @"select isnull(sum(sqty),0) as sqty
+ from TK_Wrk_OutRecord where wo_code=@wo_code and style='S' and id<>@id and step_code=@step_code and wx_code<>@wx_code";
+ dynamicParams.Add("@wo_code", json[0].wo_code);
+ dynamicParams.Add("@id", json[0].id);
+ dynamicParams.Add("@step_code", json[0].step_code);
+ dynamicParams.Add("@wx_code", json[0].wxcode);
+ var dt_c = DapperHelper.selectdata(sql, dynamicParams);
+ //鑾峰彇姝ゆ鎶ュ伐璋冩暣鎻愪氦鐨勬暟鎹�(鏀舵枡鏁伴噺銆佷笉鑹暟閲忋�佸伐搴熸暟閲忋�佹枡搴熸暟閲�)
+ decimal this_reportqty = decimal.Parse(json[0].report_qty.ToString()); //鏀舵枡鏁伴噺
decimal this_ngqty = json[0].children.Sum(item => decimal.Parse(item.ng_qty));//涓嶈壇鏁伴噺姹囨��
decimal this_laborbadqty = json[0].children.Sum(item => decimal.Parse(item.laborbad_qty));//宸ュ簾鏁伴噺姹囨��
decimal this_materielbadqty = json[0].children.Sum(item => decimal.Parse(item.materielbad_qty));//鏂欏簾鏁伴噺姹囨��
decimal this_ng_dvalue = json[0].children.Sum(item => decimal.Parse(item.ng_dvalue));//涓嶈壇鏁伴噺宸�兼眹鎬�
decimal this_laborbad_dvalue = json[0].children.Sum(item => decimal.Parse(item.laborbad_dvalue));//宸ュ簾鏁伴噺宸�兼眹鎬�
decimal this_materielbad_dvalue = json[0].children.Sum(item => decimal.Parse(item.materielbad_dvalue));//鏂欏簾鏁伴噺宸�兼眹鎬�
- //棣栭亾宸ュ簭鐨勬姤宸�
+ //鑾峰彇褰撳墠宸ュ簭銆佷緵搴斿晢瀵瑰簲鐨勫彂鏂欐暟閲�
+ sql = @"select isnull(sum(fqty),0) as fqty
+ from TK_Wrk_OutRecord where wo_code=@wo_code and style='F' and id<>@id and step_code=@step_code and wx_code=@wx_code";
+ dynamicParams.Add("@wo_code", json[0].wo_code);
+ dynamicParams.Add("@id", json[0].id);
+ dynamicParams.Add("@step_code", json[0].step_code);
+ dynamicParams.Add("@wx_code", json[0].wxcode);
+ var dt_0 = DapperHelper.selectdata(sql, dynamicParams);
+ //棣栭亾宸ュ簭鐨勬敹鏂�
if (json[0].first_choke == "Y")
{
- //鏌ヨ褰撳墠棣栭亾鎶ュ伐宸ュ簭闈炴娆℃姤宸ワ細鎬绘姤宸ユ暟閲忋�佹�讳笉鑹暟閲忋�佹�诲伐搴熸暟閲忋�佹�绘枡搴熸暟閲�
+ //鏌ヨ褰撳墠棣栭亾宸ュ簭闈炴娆℃敹鏂欙細鎬绘敹鏂欐暟閲忋�佹�讳笉鑹暟閲忋�佹�诲伐搴熸暟閲忋�佹�绘枡搴熸暟閲�
sql = @"select isnull(sum(sqty),0) as good_qty,isnull(sum(ng_qty),0) as ng_qty,isnull(sum(laborbad_qty),0) as laborbad_qty,isnull(sum(materielbad_qty),0) as materielbad_qty
- from TK_Wrk_OutRecord where wo_code=@wo_code and style='S' and id<>@id and step_code=@step_code";
+ from TK_Wrk_OutRecord where wo_code=@wo_code and style='S' and id<>@id and step_code=@step_code and wx_code=@wx_code";
dynamicParams.Add("@wo_code", json[0].wo_code);
dynamicParams.Add("@id", json[0].id);
dynamicParams.Add("@step_code", json[0].step_code);
+ dynamicParams.Add("@wx_code", json[0].wxcode);
var dt = DapperHelper.selectdata(sql, dynamicParams);
- decimal notthis_reportqty = decimal.Parse(dt.Rows[0]["good_qty"].ToString()); //褰撳墠宸ュ簭闈炴湰娆℃姤宸ユ�绘暟
+ decimal notthis_reportqty = decimal.Parse(dt.Rows[0]["good_qty"].ToString()); //褰撳墠宸ュ簭闈炴湰娆℃敹鏂欐�绘暟
decimal notthis_ngqty = decimal.Parse(dt.Rows[0]["ng_qty"].ToString()); //褰撳墠宸ュ簭闈炴湰娆℃姤宸ユ�讳笉鑹暟
decimal notthis_laborbadqty = decimal.Parse(dt.Rows[0]["laborbad_qty"].ToString()); //褰撳墠宸ュ簭闈炴湰娆℃姤宸ユ�诲伐搴熸暟
decimal notthis_materielbadqty = decimal.Parse(dt.Rows[0]["materielbad_qty"].ToString()); //褰撳墠宸ュ簭闈炴湰娆℃姤宸ユ�绘枡搴熸暟
- //鍒ゆ柇锛氬綋鍓嶅伐搴忔姤宸ヨ褰曪細鏈鎶ュ伐鏁伴噺+鏈涓嶈壇鏁伴噺+鏈宸ュ簾鏁伴噺+鏈鏂欏簾鏁伴噺+褰撳墠宸ュ簭闈炴湰娆℃姤宸ユ�绘暟+褰撳墠宸ュ簭闈炴湰娆′笉鑹�绘暟+褰撳墠宸ュ簭闈炴湰娆″伐搴熸�绘暟+褰撳墠宸ュ簭闈炴湰娆℃枡搴熸�绘暟>宸ュ崟浠诲姟鏁伴噺
+ //鍒ゆ柇锛氬綋鍓嶅伐搴忔姤宸ヨ褰曪細鏈鏀舵枡鏁伴噺+鏈涓嶈壇鏁伴噺+鏈宸ュ簾鏁伴噺+鏈鏂欏簾鏁伴噺+褰撳墠宸ュ簭闈炴湰娆℃敹鏂欐�绘暟+褰撳墠宸ュ簭闈炴湰娆′笉鑹�绘暟+褰撳墠宸ュ簭闈炴湰娆″伐搴熸�绘暟+褰撳墠宸ュ簭闈炴湰娆℃枡搴熸�绘暟>鍙戞枡鏁伴噺
decimal updatereportsumqty = this_reportqty + this_ngqty + this_laborbadqty + this_materielbadqty + notthis_reportqty + notthis_ngqty + notthis_laborbadqty + notthis_materielbadqty;
- if (updatereportsumqty > decimal.Parse(json[0].task_qty.ToString()))
+ if (updatereportsumqty > decimal.Parse(dt_0.Rows[0]["fqty"].ToString()))
{
mes.code = "300";
mes.count = 0;
- mes.Message = "褰撳墠棣栭亾宸ュ簭淇敼鎶ュ伐鎬绘暟閲忥細銆�" + updatereportsumqty + "銆戜笉鑳藉ぇ浜庡伐鍗曚换鍔℃暟閲忥細銆�" + json[0].task_qty.ToString() + "銆�!";
+ mes.message = "褰撳墠棣栭亾宸ュ簭瀵瑰簲渚涘簲鍟嗘敹鏂欐�绘暟閲忥細銆�" + updatereportsumqty + "銆戜笉鑳藉ぇ浜庡彂鏂欐暟閲忥細銆�" + decimal.Parse(dt_0.Rows[0]["fqty"].ToString()) + "銆�!";
mes.data = null;
return mes;
}
- //鏌ヨ褰撳墠宸ュ簭涓嬮亾宸ュ簭锛氭�绘姤宸ユ暟閲忋�佹�讳笉鑹暟閲忋�佹�绘姤搴熸暟閲�
- sql = @"select isnull(sum(sqty),0) as good_qty,isnull(sum(ng_qty),0) as ng_qty,isnull(sum(laborbad_qty),0) as laborbad_qty,isnull(sum(materielbad_qty),0) as materielbad_qty
- from TK_Wrk_OutRecord where wo_code=@wo_code and style='S' and step_seq=@step_seq+1";
- dynamicParams.Add("@wo_code", json[0].wo_code);
- dynamicParams.Add("@step_seq", json[0].step_seq);
- var dt0 = DapperHelper.selectdata(sql, dynamicParams);
- if (dt0.Rows.Count > 0)
+ //鍒ゆ柇鏄惁瀛樺湪涓嬮亾宸ュ簭鍙婂睘鎬�
+ if (next.Rows.Count > 0)
{
- //鍒ゆ柇褰撳墠宸ュ簭锛氭姤宸ユ�绘暟鏁伴噺+涓嶈壇鎬绘暟鏁伴噺+宸ュ簾鎬绘暟閲�+鏂欏簾鎬绘暟閲�<涓嬮亾宸ュ簭鎶ュ伐鎬绘暟閲�+涓嬮亾宸ュ簭涓嶈壇鎬绘暟閲�+涓嬮亾宸ュ簭宸ュ簾鎬绘暟閲�+涓嬮亾宸ュ簭鏂欏簾鎬绘暟閲�
- decimal last_reportqty = decimal.Parse(dt0.Rows[0]["good_qty"].ToString()); //涓嬮亾宸ュ簭鎶ュ伐鎬绘暟閲�
- decimal last_ngqty = decimal.Parse(dt0.Rows[0]["ng_qty"].ToString()); //涓嬮亾宸ュ簭涓嶈壇鎬绘暟閲�
- decimal last_laborbad_qty = decimal.Parse(dt0.Rows[0]["laborbad_qty"].ToString()); //涓嬮亾宸ュ簭宸ュ簾鎬绘暟閲�
- decimal last_materielbad_qty = decimal.Parse(dt0.Rows[0]["materielbad_qty"].ToString()); //涓嬮亾宸ュ簭鏂欏簾鎬绘暟閲�
- decimal last_updatereportsumqty = last_reportqty + last_ngqty + last_laborbad_qty + last_materielbad_qty;
- //鍒ゆ柇锛堝綋鍓嶉潪鏈鎶ュ伐鎬诲悎鏍兼暟+鏈鎶ュ伐璋冩暣鍚堟牸鏁帮級<涓嬮亾宸ュ簭鎶ュ伐鎬绘暟
- if ((notthis_reportqty + decimal.Parse(json[0].report_qty) < last_updatereportsumqty))
+ if (next.Rows[0]["flwtype"].ToString() == "Z")
{
- mes.code = "300";
- mes.count = 0;
- mes.Message = "褰撳墠棣栭亾宸ュ簭淇敼鎶ュ伐鎬诲悎鏍兼暟閲忥細銆�" + (notthis_reportqty + decimal.Parse(json[0].report_qty)) + "銆戜笉鑳藉皬浜庝笅閬撳伐搴忔姤宸ユ�绘暟閲忥細銆�" + last_updatereportsumqty + "銆�,璇疯緭鍏ュ悎娉曟暟鍊兼垨鍏堜慨鏀逛笅閬撳伐搴忔姤宸ユ暟閲�!";
- mes.data = null;
- return mes;
+ //鏌ヨ褰撳墠宸ュ簭涓嬮亾宸ュ簭锛氭�绘姤宸ユ暟閲忋�佹�讳笉鑹暟閲忋�佹�绘姤搴熸暟閲�
+ sql = @"select isnull(sum(good_qty),0) as good_qty,isnull(sum(ng_qty),0) as ng_qty,isnull(sum(laborbad_qty),0) as laborbad_qty,isnull(sum(materielbad_qty),0) as materielbad_qty
+ from TK_Wrk_Record where wo_code=@wo_code and style='B' and step_seq=@step_seq+1";
+ dynamicParams.Add("@wo_code", json[0].wo_code);
+ dynamicParams.Add("@step_seq", json[0].step_seq);
+ var dt0 = DapperHelper.selectdata(sql, dynamicParams);
+ if (dt0.Rows.Count > 0)
+ {
+ //鍒ゆ柇褰撳墠宸ュ簭锛氭姤宸ユ�绘暟鏁伴噺+涓嶈壇鎬绘暟鏁伴噺+宸ュ簾鎬绘暟閲�+鏂欏簾鎬绘暟閲�<涓嬮亾宸ュ簭鎶ュ伐鎬绘暟閲�+涓嬮亾宸ュ簭涓嶈壇鎬绘暟閲�+涓嬮亾宸ュ簭宸ュ簾鎬绘暟閲�+涓嬮亾宸ュ簭鏂欏簾鎬绘暟閲�
+ decimal last_reportqty = decimal.Parse(dt0.Rows[0]["good_qty"].ToString()); //涓嬮亾宸ュ簭鎶ュ伐鎬绘暟閲�
+ decimal last_ngqty = decimal.Parse(dt0.Rows[0]["ng_qty"].ToString()); //涓嬮亾宸ュ簭涓嶈壇鎬绘暟閲�
+ decimal last_laborbad_qty = decimal.Parse(dt0.Rows[0]["laborbad_qty"].ToString()); //涓嬮亾宸ュ簭宸ュ簾鎬绘暟閲�
+ decimal last_materielbad_qty = decimal.Parse(dt0.Rows[0]["materielbad_qty"].ToString()); //涓嬮亾宸ュ簭鏂欏簾鎬绘暟閲�
+ decimal last_updatereportsumqty = last_reportqty + last_ngqty + last_laborbad_qty + last_materielbad_qty;
+ //鍒ゆ柇锛堝綋鍓嶉潪鏈鏀舵枡鏁�+鏈鏀舵枡璋冩暣鏁�+闈炲綋鍓嶄緵搴斿晢鍚屽伐搴忔敹鏂欐�绘暟锛�<涓嬮亾宸ュ簭鎶ュ伐鎬绘暟
+ if ((notthis_reportqty + this_reportqty + decimal.Parse(dt_c.Rows[0]["sqty"].ToString())) < last_updatereportsumqty)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "褰撳墠棣栭亾宸ュ簭鏀舵枡鏁伴噺锛氥��" + (notthis_reportqty + this_reportqty + decimal.Parse(dt_c.Rows[0]["sqty"].ToString())) + "銆戜笉鑳藉皬浜庝笅閬撹嚜鍒跺伐搴忔姤宸ユ�绘暟閲忥細銆�" + last_updatereportsumqty + "銆�!";
+ mes.data = null;
+ return mes;
+ }
+ }
+ }
+ else
+ {
+ //鏌ヨ褰撳墠宸ュ簭涓嬮亾宸ュ簭锛氭�诲彂鏂欐暟閲�
+ sql = @"select isnull(sum(fqty),0) as good_qty
+ from TK_Wrk_OutRecord where wo_code=@wo_code and style='F' and step_seq=@step_seq+1";
+ dynamicParams.Add("@wo_code", json[0].wo_code);
+ dynamicParams.Add("@step_seq", json[0].step_seq);
+ var dt0 = DapperHelper.selectdata(sql, dynamicParams);
+ if (dt0.Rows.Count > 0)
+ {
+ //鍒ゆ柇褰撳墠宸ュ簭锛氬彂鏂欐�绘暟鏁伴噺
+ decimal last_reportqty = decimal.Parse(dt0.Rows[0]["good_qty"].ToString()); //涓嬮亾宸ュ簭鍙戞枡鎬绘暟閲�
+ //鍒ゆ柇锛堝綋鍓嶉潪鏈鏀舵枡鏁�+鏈鎶ュ伐璋冩暣鏀舵枡鏁帮級<涓嬮亾宸ュ簭鍙戞枡鎬绘暟
+ if ((notthis_reportqty + this_reportqty) < last_reportqty)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "褰撳墠棣栭亾宸ュ簭鏀舵枡鎬绘暟閲忥細銆�" + (notthis_reportqty + this_reportqty) + "銆戜笉鑳藉皬浜庝笅閬撳鍗忓伐搴忓彂鏂欐�绘暟閲忥細銆�" + last_reportqty + "銆�!";
+ mes.data = null;
+ return mes;
+ }
+ }
}
}
+
}
//鏈亾宸ュ簭鐨勬姤宸�
else if (json[0].last_choke == "Y")
{
- //鏌ヨ褰撳墠鏈亾鎶ュ伐宸ュ簭闈炴娆℃姤宸ワ細鎬绘姤宸ユ暟閲忋�佹�讳笉鑹暟閲忋�佹�诲伐搴熸暟閲忋�佹�绘枡搴熸暟閲�
+ //鏌ヨ褰撳墠鏈亾鎶ュ伐宸ュ簭闈炴娆℃敹鏂欙細鎬绘敹鏂欐暟閲忋�佹�讳笉鑹暟閲忋�佹�诲伐搴熸暟閲忋�佹�绘枡搴熸暟閲�
sql = @"select isnull(sum(sqty),0) as good_qty,isnull(sum(ng_qty),0) as ng_qty,isnull(sum(laborbad_qty),0) as laborbad_qty,isnull(sum(materielbad_qty),0) as materielbad_qty
- from TK_Wrk_OutRecord where wo_code=@wo_code and style='S' and id<>@id and step_code=@step_code";
+ from TK_Wrk_OutRecord where wo_code=@wo_code and style='S' and id<>@id and step_code=@step_code and wx_code=@wx_code";
dynamicParams.Add("@wo_code", json[0].wo_code);
dynamicParams.Add("@id", json[0].id);
dynamicParams.Add("@step_code", json[0].step_code);
var dt = DapperHelper.selectdata(sql, dynamicParams);
- decimal notthis_reportqty = decimal.Parse(dt.Rows[0]["good_qty"].ToString()); //褰撳墠鏈亾宸ュ簭闈炴湰娆℃姤宸ユ�绘暟
+ decimal notthis_reportqty = decimal.Parse(dt.Rows[0]["good_qty"].ToString()); //褰撳墠鏈亾宸ュ簭闈炴湰娆℃敹鏂欐�绘暟
decimal notthis_ngqty = decimal.Parse(dt.Rows[0]["ng_qty"].ToString()); //褰撳墠鏈亾宸ュ簭闈炴湰娆℃姤宸ユ�绘暟
decimal notthis_laborbad_qty = decimal.Parse(dt.Rows[0]["laborbad_qty"].ToString()); //褰撳墠鏈亾宸ュ簭闈炴湰娆℃姤宸ュ伐搴熸�绘暟
decimal notthis_materielbad_qty = decimal.Parse(dt.Rows[0]["materielbad_qty"].ToString()); //褰撳墠鏈亾宸ュ簭闈炴湰娆℃姤宸ユ枡搴熸�绘暟
- //鑾峰彇褰撳墠鏈亾宸ュ簭鎶ュ伐鎬绘暟閲忥細鏈淇敼鎶ュ伐鏁伴噺+鏈淇敼涓嶈壇鏁伴噺+鏈淇敼宸ュ簾鏁伴噺+鏈淇敼鎶ュ伐鏂欏簾鏁伴噺+褰撳墠鏈亾宸ュ簭闈炴湰娆℃姤宸ユ�绘暟+褰撳墠鏈亾宸ュ簭闈炴湰娆′笉鑹�绘暟+褰撳墠鏈亾宸ュ簭闈炴湰娆″伐搴熸�绘暟+褰撳墠鏈亾宸ュ簭闈炴湰娆℃枡搴熸�绘暟
+ //鑾峰彇褰撳墠鏈亾宸ュ簭鏀舵枡鎬绘暟閲忥細鏈淇敼鏀舵枡鏁伴噺+鏈淇敼涓嶈壇鏁伴噺+鏈淇敼宸ュ簾鏁伴噺+鏈淇敼鎶ュ伐鏂欏簾鏁伴噺+褰撳墠鏈亾宸ュ簭闈炴湰娆℃敹鏂欐�绘暟+褰撳墠鏈亾宸ュ簭闈炴湰娆′笉鑹�绘暟+褰撳墠鏈亾宸ュ簭闈炴湰娆″伐搴熸�绘暟+褰撳墠鏈亾宸ュ簭闈炴湰娆℃枡搴熸�绘暟
decimal updatereportsumqty = this_reportqty + this_ngqty + this_laborbadqty + this_materielbadqty + notthis_reportqty + notthis_ngqty + notthis_laborbad_qty + notthis_materielbad_qty;
-
- //鏌ヨ褰撳墠鏈亾宸ュ簭涓婇亾宸ュ簭锛氭�绘姤宸ユ暟閲忋�佹�讳笉鑹暟閲忋�佹�绘姤搴熸暟閲�
- sql = @"select isnull(sum(sqty),0) as good_qty,isnull(sum(ng_qty),0) as ng_qty,isnull(sum(laborbad_qty),0) as laborbad_qty,isnull(sum(materielbad_qty),0) as materielbad_qty
- from TK_Wrk_OutRecord where wo_code=@wo_code and style='S' and step_seq=@step_seq-1";
- dynamicParams.Add("@wo_code", json[0].wo_code);
- dynamicParams.Add("@step_seq", json[0].step_seq);
- var dt0 = DapperHelper.selectdata(sql, dynamicParams);
- if (dt0.Rows.Count > 0)
+ //鍒ゆ柇褰撳墠宸ュ簭渚涘簲鍟嗘敹鏂欐�绘暟>褰撳墠宸ュ簭渚涘簲鍟嗗搴斿彂鏂欐暟閲�
+ if (updatereportsumqty > decimal.Parse(dt_0.Rows[0]["fqty"].ToString()))
{
- decimal last_reportqty = decimal.Parse(dt0.Rows[0]["good_qty"].ToString()); //涓婇亾宸ュ簭鎶ュ伐鎬绘暟閲�
- decimal last_ngqty = decimal.Parse(dt0.Rows[0]["ng_qty"].ToString()); //涓婇亾宸ュ簭涓嶈壇鎬绘暟閲�
- decimal last_laborbad_qty = decimal.Parse(dt0.Rows[0]["laborbad_qty"].ToString()); //涓婇亾宸ュ簭宸ュ簾鎬绘暟閲�
- decimal last_materielbad_qty = decimal.Parse(dt0.Rows[0]["materielbad_qty"].ToString()); //涓婇亾宸ュ簭鏂欏簾鎬绘暟閲�
- decimal last_updatereportsumqty = last_reportqty + last_ngqty + last_laborbad_qty + last_materielbad_qty;
- //鍒ゆ柇锛氬綋鍓嶆湯閬撳伐搴忔姤宸ヨ褰曪細褰撳墠鏈亾宸ュ簭鎶ュ伐鎬绘暟閲�>涓婇亾宸ュ簭鎶ュ伐鍚堟牸鎬绘暟
- if (updatereportsumqty > last_reportqty)
- {
- mes.code = "300";
- mes.count = 0;
- mes.Message = "褰撳墠鏈亾宸ュ簭淇敼鎶ュ伐鎬绘暟閲忥細銆�" + updatereportsumqty + "銆戜笉鑳藉ぇ浜庝笂閬撳伐搴忔姤宸ユ�诲悎鏍兼暟閲忥細銆�" + last_reportqty + "銆�,璇疯緭鍏ュ悎娉曟暟鍊兼垨鍏堜慨鏀逛笂閬撳伐搴忔姤宸ユ暟閲�!";
- mes.data = null;
- return mes;
- }
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "褰撳墠宸ュ簭渚涘簲鍟嗘敹鏂欐�绘暟閲忥細銆�" + updatereportsumqty + "銆戜笉鑳藉ぇ浜庡伐搴忎緵搴斿晢鍙戞枡鎬绘暟閲忥細銆�" + decimal.Parse(dt_0.Rows[0]["fqty"].ToString()) + "銆�!";
+ mes.data = null;
+ return mes;
}
+
}
else //涓棿宸ュ簭鐨勬姤宸�
{
- //鏌ヨ褰撳墠涓棿鎶ュ伐宸ュ簭闈炴娆℃姤宸ワ細鎬绘姤宸ユ暟閲忋�佹�讳笉鑹暟閲忋�佹�绘姤搴熸暟閲�
+
+ //鏌ヨ褰撳墠棣栭亾宸ュ簭渚涘簲鍟嗛潪姝ゆ鏀舵枡锛氭�绘敹鏂欐暟閲忋�佹�讳笉鑹暟閲忋�佹�诲伐搴熸暟閲忋�佹�绘枡搴熸暟閲�
sql = @"select isnull(sum(sqty),0) as good_qty,isnull(sum(ng_qty),0) as ng_qty,isnull(sum(laborbad_qty),0) as laborbad_qty,isnull(sum(materielbad_qty),0) as materielbad_qty
- from TK_Wrk_OutRecord where wo_code=@wo_code and style='S' and id<>@id and step_code=@step_code";
+ from TK_Wrk_OutRecord where wo_code=@wo_code and style='S' and id<>@id and step_code=@step_code and wx_code=@wx_code";
dynamicParams.Add("@wo_code", json[0].wo_code);
dynamicParams.Add("@id", json[0].id);
dynamicParams.Add("@step_code", json[0].step_code);
+ dynamicParams.Add("@wx_code", json[0].wxcode);
var dt = DapperHelper.selectdata(sql, dynamicParams);
- decimal notthis_reportqty = decimal.Parse(dt.Rows[0]["good_qty"].ToString()); //褰撳墠宸ュ簭闈炴湰娆℃姤宸ユ�绘暟
- decimal notthis_ngqty = decimal.Parse(dt.Rows[0]["ng_qty"].ToString()); //褰撳墠宸ュ簭闈炴湰娆℃姤宸ユ�绘暟
- decimal notthis_laborbad_qty = decimal.Parse(dt.Rows[0]["laborbad_qty"].ToString()); //褰撳墠宸ュ簭闈炴湰娆℃姤宸ュ伐璐规�绘暟
- decimal notthis_materielbad_qty = decimal.Parse(dt.Rows[0]["materielbad_qty"].ToString()); //褰撳墠宸ュ簭闈炴湰娆℃姤宸ユ枡搴熸�绘暟
- //鑾峰彇褰撳墠涓棿宸ュ簭鎶ュ伐鎬绘暟閲忥細鏈淇敼鎶ュ伐鏁伴噺+鏈淇敼涓嶈壇鏁伴噺+鏈淇敼宸ュ簾鏁伴噺+鏈淇敼鏂欏簾鎬绘暟+褰撳墠宸ュ簭闈炴湰娆℃姤宸ユ�绘暟+褰撳墠宸ュ簭闈炴湰娆′笉鑹�绘暟+褰撳墠宸ュ簭闈炴湰娆″伐搴熸�绘暟+褰撳墠宸ュ簭闈炴湰娆℃枡搴熸�绘暟
- decimal updatereportsumqty = this_reportqty + this_ngqty + this_laborbadqty + this_materielbadqty + notthis_reportqty + notthis_ngqty + notthis_laborbad_qty + notthis_materielbad_qty;
- //鏌ヨ褰撳墠宸ュ簭涓婇亾宸ュ簭锛氭�绘姤宸ユ暟閲忋�佹�讳笉鑹暟閲忋�佹�诲伐搴熸暟閲忋�佹�绘枡搴熸暟閲�
- sql = @"select isnull(sum(sqty),0) as good_qty,isnull(sum(ng_qty),0) as ng_qty,isnull(sum(laborbad_qty),0) as laborbad_qty,isnull(sum(materielbad_qty),0) as materielbad_qty
- from TK_Wrk_OutRecord where wo_code=@wo_code and style='S' and step_seq=@step_seq-1";
- dynamicParams.Add("@wo_code", json[0].wo_code);
- dynamicParams.Add("@step_seq", json[0].step_seq);
- var dt0 = DapperHelper.selectdata(sql, dynamicParams);
- if (dt0.Rows.Count > 0)
+ decimal notthis_reportqty = decimal.Parse(dt.Rows[0]["good_qty"].ToString()); //褰撳墠宸ュ簭闈炴湰娆℃敹鏂欐�绘暟
+ decimal notthis_ngqty = decimal.Parse(dt.Rows[0]["ng_qty"].ToString()); //褰撳墠宸ュ簭闈炴湰娆℃姤宸ユ�讳笉鑹暟
+ decimal notthis_laborbadqty = decimal.Parse(dt.Rows[0]["laborbad_qty"].ToString()); //褰撳墠宸ュ簭闈炴湰娆℃姤宸ユ�诲伐搴熸暟
+ decimal notthis_materielbadqty = decimal.Parse(dt.Rows[0]["materielbad_qty"].ToString()); //褰撳墠宸ュ簭闈炴湰娆℃姤宸ユ�绘枡搴熸暟
+ //鍒ゆ柇锛氬綋鍓嶅伐搴忔姤宸ヨ褰曪細鏈鏀舵枡鏁伴噺+鏈涓嶈壇鏁伴噺+鏈宸ュ簾鏁伴噺+鏈鏂欏簾鏁伴噺+褰撳墠宸ュ簭闈炴湰娆℃敹鏂欐�绘暟+褰撳墠宸ュ簭闈炴湰娆′笉鑹�绘暟+褰撳墠宸ュ簭闈炴湰娆″伐搴熸�绘暟+褰撳墠宸ュ簭闈炴湰娆℃枡搴熸�绘暟>鍙戞枡鏁伴噺
+ decimal updatereportsumqty = this_reportqty + this_ngqty + this_laborbadqty + this_materielbadqty + notthis_reportqty + notthis_ngqty + notthis_laborbadqty + notthis_materielbadqty;
+ if (updatereportsumqty > decimal.Parse(dt_0.Rows[0]["fqty"].ToString()))
{
- decimal last_reportqty = decimal.Parse(dt0.Rows[0]["good_qty"].ToString()); //涓婇亾宸ュ簭鎶ュ伐鎬诲悎鏍兼暟閲�
- decimal last_ngqty = decimal.Parse(dt0.Rows[0]["ng_qty"].ToString()); //涓婇亾宸ュ簭涓嶈壇鎬绘暟閲�
- decimal last_laborbad_qty = decimal.Parse(dt0.Rows[0]["laborbad_qty"].ToString()); //涓婇亾宸ュ簭宸ュ簾鎬绘暟閲�
- decimal last_materielbad_qty = decimal.Parse(dt0.Rows[0]["materielbad_qty"].ToString());//涓婇亾宸ュ簭鏂欏簾鎬绘暟閲�
- decimal last_updatereportsumqty = last_reportqty + last_ngqty + last_laborbad_qty + last_materielbad_qty;
- //鍒ゆ柇锛氬綋鍓嶅伐搴忔姤宸ヨ褰曪細褰撳墠宸ュ簭鎶ュ伐鎬绘暟>涓婇亾宸ュ簭鎶ュ伐鎬诲悎鏍兼暟
- if (updatereportsumqty > last_reportqty)
- {
- mes.code = "300";
- mes.count = 0;
- mes.Message = "褰撳墠宸ュ簭淇敼鎶ュ伐鎬绘暟閲忥細銆�" + updatereportsumqty + "銆戜笉鑳藉ぇ浜庝笂閬撳伐搴忔姤宸ユ�诲悎鏍兼暟閲忥細銆�" + last_reportqty + "銆�,璇疯緭鍏ュ悎娉曟暟鍊兼垨鍏堜慨鏀逛笂閬撳伐搴忔姤宸ユ暟閲�!";
- mes.data = null;
- return mes;
- }
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "褰撳墠棣栭亾宸ュ簭瀵瑰簲渚涘簲鍟嗘敹鏂欐�绘暟閲忥細銆�" + updatereportsumqty + "銆戜笉鑳藉ぇ浜庡彂鏂欐暟閲忥細銆�" + decimal.Parse(dt_0.Rows[0]["fqty"].ToString()) + "銆�!";
+ mes.data = null;
+ return mes;
}
- //鏌ヨ褰撳墠宸ュ簭涓嬮亾宸ュ簭锛氭�绘姤宸ユ暟閲忋�佹�讳笉鑹暟閲忋�佹�绘姤搴熸暟閲�
- sql = @"select isnull(sum(sqty),0) as good_qty,isnull(sum(ng_qty),0) as ng_qty,isnull(sum(laborbad_qty),0) as laborbad_qty,isnull(sum(materielbad_qty),0) as materielbad_qty
- from TK_Wrk_OutRecord where wo_code=@wo_code and style='S' and step_seq=@step_seq+1";
- dynamicParams.Add("@wo_code", json[0].wo_code);
- dynamicParams.Add("@step_seq", json[0].step_seq);
- var dt1 = DapperHelper.selectdata(sql, dynamicParams);
- if (dt1.Rows.Count > 0)
+ //鍒ゆ柇鏄惁瀛樺湪涓嬮亾宸ュ簭鍙婂睘鎬�
+ if (next.Rows.Count > 0)
{
- decimal last_reportqty = decimal.Parse(dt1.Rows[0]["good_qty"].ToString()); //涓嬮亾宸ュ簭鎶ュ伐鎬绘暟閲�
- decimal last_ngqty = decimal.Parse(dt1.Rows[0]["ng_qty"].ToString()); //涓嬮亾宸ュ簭涓嶈壇鎬绘暟閲�
- decimal last_laborbad_qty = decimal.Parse(dt1.Rows[0]["laborbad_qty"].ToString()); //涓嬮亾宸ュ簭宸ュ簾鎬绘暟閲�
- decimal last_materielbad_qty = decimal.Parse(dt1.Rows[0]["materielbad_qty"].ToString()); //涓嬮亾宸ュ簭鏂欏簾鎬绘暟閲�
- decimal last_updatereportsumqty = last_reportqty + last_ngqty + last_laborbad_qty + last_materielbad_qty;
- //鍒ゆ柇锛堝綋鍓嶉潪鏈鎶ュ伐鎬诲悎鏍兼暟+鏈鎶ュ伐璋冩暣鍚堟牸鏁帮級<涓嬮亾宸ュ簭鎶ュ伐鎬绘暟
- if ((notthis_reportqty + decimal.Parse(json[0].report_qty)< last_updatereportsumqty))
+ if (next.Rows[0]["flwtype"].ToString() == "Z")
{
- mes.code = "300";
- mes.count = 0;
- mes.Message = "褰撳墠宸ュ簭淇敼鎶ュ伐鎬诲悎鏍兼暟閲忥細銆�" + (notthis_reportqty + decimal.Parse(json[0].report_qty)) + "銆戜笉鑳藉皬浜庝笅閬撳伐搴忔姤宸ユ�绘暟閲忥細銆�" + last_updatereportsumqty + "銆�,璇疯緭鍏ュ悎娉曟暟鍊兼垨鍏堜慨鏀逛笅閬撳伐搴忔姤宸ユ暟閲�!";
- mes.data = null;
- return mes;
+ //鏌ヨ褰撳墠宸ュ簭涓嬮亾宸ュ簭锛氭�绘姤宸ユ暟閲忋�佹�讳笉鑹暟閲忋�佹�绘姤搴熸暟閲�
+ sql = @"select isnull(sum(good_qty),0) as good_qty,isnull(sum(ng_qty),0) as ng_qty,isnull(sum(laborbad_qty),0) as laborbad_qty,isnull(sum(materielbad_qty),0) as materielbad_qty
+ from TK_Wrk_Record where wo_code=@wo_code and style='B' and step_seq=@step_seq+1";
+ dynamicParams.Add("@wo_code", json[0].wo_code);
+ dynamicParams.Add("@step_seq", json[0].step_seq);
+ var dt0 = DapperHelper.selectdata(sql, dynamicParams);
+ if (dt0.Rows.Count > 0)
+ {
+ //鍒ゆ柇褰撳墠宸ュ簭锛氭姤宸ユ�绘暟鏁伴噺+涓嶈壇鎬绘暟鏁伴噺+宸ュ簾鎬绘暟閲�+鏂欏簾鎬绘暟閲�<涓嬮亾宸ュ簭鎶ュ伐鎬绘暟閲�+涓嬮亾宸ュ簭涓嶈壇鎬绘暟閲�+涓嬮亾宸ュ簭宸ュ簾鎬绘暟閲�+涓嬮亾宸ュ簭鏂欏簾鎬绘暟閲�
+ decimal last_reportqty = decimal.Parse(dt0.Rows[0]["good_qty"].ToString()); //涓嬮亾宸ュ簭鎶ュ伐鎬绘暟閲�
+ decimal last_ngqty = decimal.Parse(dt0.Rows[0]["ng_qty"].ToString()); //涓嬮亾宸ュ簭涓嶈壇鎬绘暟閲�
+ decimal last_laborbad_qty = decimal.Parse(dt0.Rows[0]["laborbad_qty"].ToString()); //涓嬮亾宸ュ簭宸ュ簾鎬绘暟閲�
+ decimal last_materielbad_qty = decimal.Parse(dt0.Rows[0]["materielbad_qty"].ToString()); //涓嬮亾宸ュ簭鏂欏簾鎬绘暟閲�
+ decimal last_updatereportsumqty = last_reportqty + last_ngqty + last_laborbad_qty + last_materielbad_qty;
+ //鍒ゆ柇锛堝綋鍓嶉潪鏈鏀舵枡鏁�+鏈鏀舵枡璋冩暣鏁�+闈炲綋鍓嶄緵搴斿晢鍚屽伐搴忔敹鏂欐�绘暟锛�<涓嬮亾宸ュ簭鎶ュ伐鎬绘暟
+ if ((notthis_reportqty + this_reportqty + decimal.Parse(dt_c.Rows[0]["sqty"].ToString())) < last_updatereportsumqty)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "褰撳墠棣栭亾宸ュ簭鏀舵枡鏁伴噺锛氥��" + (notthis_reportqty + this_reportqty + decimal.Parse(dt_c.Rows[0]["sqty"].ToString())) + "銆戜笉鑳藉皬浜庝笅閬撹嚜鍒跺伐搴忔姤宸ユ�绘暟閲忥細銆�" + last_updatereportsumqty + "銆�!";
+ mes.data = null;
+ return mes;
+ }
+ }
+ }
+ else
+ {
+ //鏌ヨ褰撳墠宸ュ簭涓嬮亾宸ュ簭锛氭�诲彂鏂欐暟閲�
+ sql = @"select isnull(sum(fqty),0) as good_qty
+ from TK_Wrk_OutRecord where wo_code=@wo_code and style='F' and step_seq=@step_seq+1";
+ dynamicParams.Add("@wo_code", json[0].wo_code);
+ dynamicParams.Add("@step_seq", json[0].step_seq);
+ var dt0 = DapperHelper.selectdata(sql, dynamicParams);
+ if (dt0.Rows.Count > 0)
+ {
+ //鍒ゆ柇褰撳墠宸ュ簭锛氬彂鏂欐�绘暟鏁伴噺
+ decimal last_reportqty = decimal.Parse(dt0.Rows[0]["good_qty"].ToString()); //涓嬮亾宸ュ簭鍙戞枡鎬绘暟閲�
+ //鍒ゆ柇锛堝綋鍓嶉潪鏈鏀舵枡鏁�+鏈鎶ュ伐璋冩暣鏀舵枡鏁�+闈炲綋鍓嶄緵搴斿晢鍚屽伐搴忔敹鏂欐�绘暟锛�<涓嬮亾宸ュ簭鍙戞枡鎬绘暟
+ if ((notthis_reportqty + this_reportqty + decimal.Parse(dt_c.Rows[0]["sqty"].ToString())) < last_reportqty)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "褰撳墠棣栭亾宸ュ簭鏀舵枡鎬绘暟閲忥細銆�" + (notthis_reportqty + this_reportqty + decimal.Parse(dt_c.Rows[0]["sqty"].ToString())) + "銆戜笉鑳藉皬浜庝笅閬撳鍗忓伐搴忓彂鏂欐�绘暟閲忥細銆�" + last_reportqty + "銆�!";
+ mes.data = null;
+ return mes;
+ }
+ }
}
}
}
///////////////////////////////淇敼鎶ュ伐//////////////////////////////
- //鍥炲啓瀵瑰簲鐨勫鍗忚褰曞瓙琛ㄥ悎鏍兼暟閲忋�佷笉鑹暟閲忋�佹姤搴熸暟閲�
+ //鍥炲啓瀵瑰簲鐨勫鍗忚褰曞瓙琛ㄦ敹鏂欐暟閲忋�佷笉鑹暟閲忋�佹姤搴熸暟閲�
sql = @"update TK_Wrk_OutRecordSub set sqty=sqty+@repair_qty,ng_qty=ng_qty+@ng_qty,laborbad_qty=laborbad_qty+@laborbad_qty,materielbad_qty=materielbad_qty+@materielbad_qty,
updatereportuser=@updatereportuser,updatereportdate=@updatereportdate
- where m_id=@m_id and id=@id and style='S'";
+ where m_id=@m_id and id=@id and style='S' and wx_code=@wx_code";
list.Add(new
{
str = sql,
@@ -2898,14 +3281,16 @@
ng_qty = this_ng_dvalue,
laborbad_qty = this_laborbad_dvalue,
materielbad_qty = this_materielbad_dvalue,
+ wx_code = json[0].wxcode,
//bad_money = decimal.Parse(json[i].badmoney_dvalue),
updatereportuser = us.usercode,
updatereportdate = date
}
});
- //鍥炲啓瀵瑰簲鐨勫鍗忚褰曚富琛ㄥ悎鏍兼暟閲忋�佷笉鑹暟閲忋�佹姤搴熸暟閲�
- sql = @"update TK_Wrk_OutRecord set sqty=sqty+@good_qty,ng_qty=ng_qty+@ng_qty,laborbad_qty=laborbad_qty+@laborbad_qty,materielbad_qty=materielbad_qty+@materielbad_qty
- where wo_code=@wo_code and step_code=@step_code and id=@id and style='S'";
+ //鍥炲啓瀵瑰簲鐨勬敹鏂欒褰曚富琛ㄦ敹鏂欐暟閲忋�佷笉鑹暟閲忋�佹姤搴熸暟閲�
+ sql = @"update TK_Wrk_OutRecord set sqty=sqty+@good_qty,ng_qty=ng_qty+@ng_qty,laborbad_qty=laborbad_qty+@laborbad_qty,materielbad_qty=materielbad_qty+@materielbad_qty,
+ updatereportuser=@updatereportuser,updatereportdate=@updatereportdate
+ where wo_code=@wo_code and step_code=@step_code and id=@id and style='S' and wx_code=@wx_code";
list.Add(new
{
str = sql,
@@ -2915,9 +3300,12 @@
ng_qty = this_ng_dvalue,
laborbad_qty = this_laborbad_dvalue,
materielbad_qty = this_materielbad_dvalue,
+ wx_code = json[0].wxcode,
wo_code = json[0].wo_code,
step_code = json[0].step_code,
- id = int.Parse(json[0].id)
+ id = int.Parse(json[0].id),
+ updatereportuser = us.usercode,
+ updatereportdate = date
}
});
//鍥炲啓宸ュ崟宸ュ簭琛�
@@ -2936,7 +3324,7 @@
step_code = json[0].step_code
}
});
-
+
for (int i = 0; i < json[0].children.Count; i++)
{
//鍥炲啓涓嶈壇
@@ -2986,14 +3374,14 @@
LogHelper.DbOperateLog(us.usercode, "鎶ュ伐璋冩暣", "宸ュ崟:" + json[0].wo_code + "宸ュ簭:" + json[0].step_code, us.usertype);
mes.code = "200";
mes.count = 0;
- mes.Message = "淇敼鎶ュ伐鎴愬姛!";
+ mes.message = "淇敼鎶ュ伐鎴愬姛!";
mes.data = null;
}
else
{
mes.code = "300";
mes.count = 0;
- mes.Message = "淇敼鎶ュ伐澶辫触!";
+ mes.message = "淇敼鎶ュ伐澶辫触!";
mes.data = null;
}
}
@@ -3001,7 +3389,183 @@
{
mes.code = "300";
mes.count = 0;
- mes.Message = e.Message;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+
+
+ #region[鐢熶骇鎵ц,鎶ュ伐瀹℃牳鍒楄〃鏁版嵁鏌ヨ鎺ュ彛]
+ public static ToMessage MesOrderStepReportVerifySearch(string reviewstatus, string wkshopcode, string wo_code, string partnumber, string partname, string partspec, string stepname, string reportuser, string reportdateopendate, string reportdateclosedate, int startNum, int endNum, string prop, string order)
+ {
+ var dynamicParams = new DynamicParameters();
+ string search = "";
+ try
+ {
+ if (reviewstatus != "" && reviewstatus != null)
+ {
+ search += "and AA.verify=@reviewstatus ";
+ dynamicParams.Add("@reviewstatus", reviewstatus);
+ }
+ if (wkshopcode != "" && wkshopcode != null)
+ {
+ search += "and AA.wkshp_code=@wkshopcode ";
+ dynamicParams.Add("@wkshopcode", wkshopcode);
+ }
+ if (wo_code != "" && wo_code != null)
+ {
+ search += "and AA.wo_code like '%'+@wo_code+'%' ";
+ dynamicParams.Add("@wo_code", wo_code);
+ }
+ if (partnumber != "" && partnumber != null)
+ {
+ search += "and AA.partnumber like '%'+@partnumber+'%' ";
+ dynamicParams.Add("@partnumber", partnumber);
+ }
+ if (partname != "" && partname != null)
+ {
+ search += "and AA.partname like '%'+@partname+'%' ";
+ dynamicParams.Add("@partname", partname);
+ }
+ if (partspec != "" && partspec != null)
+ {
+ search += "and AA.partspec like '%'+@partspec+'%' ";
+ dynamicParams.Add("@partspec", partspec);
+ }
+ if (stepname != "" && stepname != null)
+ {
+ search += "and AA.stepname like '%'+@stepname+'%' ";
+ dynamicParams.Add("@stepname", stepname);
+ }
+ if (reportuser != "" && reportuser != null)
+ {
+ search += "and AA.usercode like '%'+@reportuser+'%' ";
+ dynamicParams.Add("@reportuser", reportuser);
+ }
+ if (reportdateopendate != "" && reportdateopendate != null)
+ {
+ search += "and AA.report_date between @reportdateopendate and @reportdateclosedate ";
+ dynamicParams.Add("@reportdateopendate", reportdateopendate + " 00:00:00");
+ dynamicParams.Add("@reportdateclosedate", reportdateclosedate + " 23:59:59");
+ }
+
+
+ if (search == "")
+ {
+ search = "and 1=1 ";
+ }
+ search = search.Substring(3);//鎴彇绱㈠紩2鍚庨潰鐨勫瓧绗�
+ // --------------鏌ヨ鎸囧畾鑷埗鎶ュ伐澶栧崗鏀舵枡鏁版嵁--------------
+ var total = 0; //鎬绘潯鏁�
+ var sql = @"select * from(
+ select A.id,B.id as sbid,A.wo_code,A.materiel_code as partnumber,P.partname,P.partspec,A.task_qty,M.wkshp_code,T.torg_name as wkshp_name,A.eqp_code,E.name as eqp_name,
+ A.step_seq,A.step_code,S.stepname,S.flwtype as steptype,k.isbott as first_choke,k.isend as last_choke,A.step_price,B.reckway,B.usergroup_code,G.usergroupname as usergroup_name,
+ B.report_person as usercode,
+ STUFF((SELECT ',' + U.username
+ FROM TUser U
+ WHERE CHARINDEX(',' + U.usercode + ',', ',' + B.report_person + ',') > 0
+ FOR XML PATH('')), 1, 1, '') AS username,
+ B.report_date,B.report_qty,B.ng_qty,B.laborbad_qty,B.materielbad_qty,'' as wx_code,'' as wx_name,A.verify
+ from TK_Wrk_Record A
+ 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 TK_Wrk_Step K on M.wo_code=K.wo_code and A.step_code=K.step_code
+ left join TStep S on A.step_code=S.stepcode
+ left join TMateriel_Info P on A.materiel_code=P.partcode
+ left join TOrganization T on M.wkshp_code=T.torg_code
+ left join TEqpInfo E on A.eqp_code=E.code
+ left join TGroup G on G.usergroupcode=B.usergroup_code
+ where A.style='B' and B.style='B' and M.status<>'CLOSED'
+ union all
+ select A.id,B.id as sbid,A.wo_code,A.materiel_code as partnumber,P.partname,P.partspec,M.plan_qty as task_qty,M.wkshp_code,T.torg_name as wkshp_name,A.wx_code as eqp_code,E.name as eqp_name,
+ A.step_seq,A.step_code,S.stepname,S.flwtype as steptype,k.isbott as first_choke,k.isend as last_choke,A.step_price,'person' as reckway,'' as usergroup_code,'' as usergroup_name,
+ B.in_person as usercode,
+ STUFF((SELECT ',' + U.username
+ FROM TUser U
+ WHERE CHARINDEX(',' + U.usercode + ',', ',' + B.in_person + ',') > 0
+ FOR XML PATH('')), 1, 1, '') AS username,
+ B.in_time as report_date,B.sqty as report_qty,B.ng_qty,B.laborbad_qty,B.materielbad_qty,A.wx_code,C.name as wx_name,A.verify
+ from TK_Wrk_OutRecord A
+ inner join TK_Wrk_OutRecordSub B on A.id = B.m_id
+ left join TK_Wrk_Man M on A.wo_code = M.wo_code
+ left join TK_Wrk_Step K on M.wo_code=K.wo_code and A.step_code=K.step_code
+ left join TStep S on A.step_code = S.stepcode
+ left join TMateriel_Info P on A.materiel_code = P.partcode
+ left join TOrganization T on M.wkshp_code = T.torg_code
+ left join TCustomer E on A.wx_code = E.code
+ left join TCustomer C on A.wx_code=C.code
+ where A.style = 'S' and B.style = 'S' and M.status<>'CLOSED'
+ ) as AA where " + search;
+ var data = DapperHelper.GetPageList<object>(sql, dynamicParams, prop, order, startNum, endNum, out total);
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.count = total;
+ mes.data = data.ToList();
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[鐢熶骇鎵ц,鎶ュ伐瀹℃牳鏁版嵁鎻愪氦]
+ public static ToMessage MesOrderStepReportVerifySeave(User us, DataModel json)
+ {
+ var sql = "";
+ List<object> list = new List<object>();
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ if (json.zdata.Count > 0)
+ {
+ //鍥炲啓鎶ュ伐璁板綍涓昏〃瀹℃牳鐘舵�併�佸鏍镐汉銆佸鏍告椂闂�
+ sql = @"update TK_Wrk_Record set verify='Y',verifyuser=@verifyuser,verifydate=@verifydate where id in @id";
+ list.Add(new { str = sql, parm = new { verifyuser = us.usercode, verifydate = DateTime.Now.ToString(), id = json.zdata } });
+ //鍥炲啓鎶ュ伐璁板綍瀛愯〃瀹℃牳鐘舵�併�佸鏍镐汉銆佸鏍告椂闂�
+ sql = @"update TK_Wrk_RecordSub set verify='Y',verifyuser=@verifyuser,verifydate=@verifydate where m_id in @id";
+ list.Add(new { str = sql, parm = new { verifyuser = us.usercode, verifydate = DateTime.Now.ToString(), id = json.zdata } });
+ }
+ if (json.wdata.Count > 0)
+ {
+ //鍥炲啓澶栧崗璁板綍涓昏〃瀹℃牳鐘舵�併�佸鏍镐汉銆佸鏍告椂闂�
+ sql = @"update TK_Wrk_OutRecord set verify='Y',verifyuser=@verifyuser,verifydate=@verifydate where id in @id";
+ list.Add(new { str = sql, parm = new { verifyuser = us.usercode, verifydate = DateTime.Now.ToString(), id = json.wdata } });
+ //鍥炲啓澶栧崗璁板綍瀛愯〃瀹℃牳鐘舵�併�佸鏍镐汉銆佸鏍告椂闂�
+ sql = @"update TK_Wrk_OutRecordSub set verify='Y',verifyuser=@verifyuser,verifydate=@verifydate where m_id in @id";
+ list.Add(new { str = sql, parm = new { verifyuser = us.usercode, verifydate = DateTime.Now.ToString(), id = json.wdata } });
+ }
+ bool aa = DapperHelper.DoTransaction(list);
+ if (aa)
+ {
+ //鍐欏叆鎿嶄綔璁板綍琛�
+ LogHelper.DbOperateLog(us.usercode, "鎶ュ伐瀹℃牳", "鑷埗鎶ュ伐璁板綍id:" + string.Join(",", json.zdata), us.usertype);
+ LogHelper.DbOperateLog(us.usercode, "鎶ュ伐瀹℃牳", "澶栧崗鏀舵枡璁板綍id:" + string.Join(",", json.wdata), us.usertype);
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "瀹℃牳鎴愬姛!";
+ mes.data = null;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "瀹℃牳澶辫触!";
+ mes.data = null;
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
mes.data = null;
}
return mes;
--
Gitblit v1.9.3