From af7cef297da2ac1937dbcf437c3a91b00658f6c2 Mon Sep 17 00:00:00 2001
From: yl <ykxkd@outlook.com>
Date: 星期三, 29 三月 2023 10:47:39 +0800
Subject: [PATCH] 订单下达获取工单语句修改,手工创建工单获取单号接口
---
VueWebApi/DLL/DAL/ProductModelDAL.cs | 108 ++++++++++++++++++++++++++++++++++++++++++++----------
1 files changed, 88 insertions(+), 20 deletions(-)
diff --git a/VueWebApi/DLL/DAL/ProductModelDAL.cs b/VueWebApi/DLL/DAL/ProductModelDAL.cs
index e113945..349090b 100644
--- a/VueWebApi/DLL/DAL/ProductModelDAL.cs
+++ b/VueWebApi/DLL/DAL/ProductModelDAL.cs
@@ -1295,7 +1295,7 @@
{
is_firststep = "Y";
}
- else if (Convert.ToInt32(json.Data.Rows[i]["SEQ"].ToString()) == json.Data.Rows.Count) //鏄惁鏈亾宸ュ簭
+ if (Convert.ToInt32(json.Data.Rows[i]["SEQ"].ToString()) == json.Data.Rows.Count) //鏄惁鏈亾宸ュ簭
{
is_laststep = "Y";
}
@@ -1339,6 +1339,18 @@
var dynamicParams = new DynamicParameters();
try
{
+ //鍒ゆ柇宸ヨ壓璺矾绾挎槸鍚﹁瀛樿揣缁戝畾
+ sql = @"select * from TMateriel_Route where route_code=@routecode";
+ dynamicParams.Add("@routecode", routecode);
+ var data_0 = DapperHelper.selectdata(sql, dynamicParams);
+ if (data_0.Rows.Count > 0)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.Message = "瀛樿揣妗f宸插叧鑱斿伐鑹鸿矾绾匡紝涓嶅厑璁稿垹闄�!";
+ mes.data = null;
+ return mes;
+ }
//鍒ゆ柇宸ヨ壓璺嚎鏄惁琚伐鍗曞紩鐢�(琚紩鐢ㄥ垯涓嶈兘鍒犻櫎)
sql = @"select * from TK_Wrk_Man where route_code=@routecode";
dynamicParams.Add("@routecode", routecode);
@@ -1575,6 +1587,9 @@
//淇敼宸ュ簭琛ㄥ叧鑱斿伐浣滅珯鏍囪瘑
sql_1 = @"update TStep set is_eqp='N' where stepcode=@stepcode";
list.Add(new { str = sql_1, parm = new { stepcode = stepcode } });
+ //鍒犻櫎璁惧鑺傛媿宸ヤ环琛�
+ sql_1 = @"delete TPrteEqp_Stad where step_code=@stepcode";
+ list.Add(new { str = sql_1, parm = new { stepcode = stepcode } });
}
}
@@ -1688,13 +1703,13 @@
where A.step_code=@stepcode and A.is_delete<>'1' and B.is_delete<>'1'
) B on T.org_code=B.wksp_code where T.description='W' and is_delete<>'1'
UNION ALL
- select distinct T.btype as wksp_code,(case T.btype when 'WX' then '澶栧崗渚涙柟' end ) as wksp_name,'W' as type,(case when B.btype is null then 'N' else 'Y' end) flag
+ select distinct T.type as wksp_code,(case when T.type='211' then '渚涘簲鍟�' when T.type='228' then '瀹㈡埛/渚涘簲鍟�' end ) as wksp_name,'W' as type,(case when B.type is null then 'N' else 'Y' end) flag
from TCustomer T
left join(
- select distinct A.eqp_code,B.btype from TFlw_Rteqp A
+ select distinct A.eqp_code,B.type from TFlw_Rteqp A
inner join TCustomer B on A.eqp_code=B.code
- where A.step_code=@stepcode and A.is_delete<>'1' and B.is_delete<>'1'
- ) B on T.btype=B.btype where T.btype='WX' and T.is_delete<>'1'";
+ where A.step_code=@stepcode and A.is_delete<>'1' and B.is_delete<>'1'
+ ) B on T.type=B.type where T.type in('211','228') and T.is_delete<>'1'"; //226(瀹㈡埛)
dynamicParams.Add("@stepcode", stepcode);
var data = DapperHelper.selectdata(sql, dynamicParams);
for (int i = 0; i < data.Rows.Count; i++)
@@ -1705,7 +1720,7 @@
rout.type = data.Rows[i]["TYPE"].ToString();
rout.flag = data.Rows[i]["FLAG"].ToString();
rout.children = new List<StepEqpCn>();
- if (rout.code == "WX") //澶栧崗渚涙柟
+ if (rout.code == "211"|| rout.code == "228") //澶栧崗渚涙柟
{
//鏍规嵁澶栧崗渚涙柟鏍囪瘑缂栫爜鏌ユ壘澶栧崗渚涙柟淇℃伅(鍖呭惈宸插叧鑱旀爣璇�)
sql = @"select A.code,A.name,'W' as type,(case when B.eqp_code is null then 'N' else 'Y' end) flag
@@ -1713,8 +1728,9 @@
left join(
select distinct A.eqp_code from TFlw_Rteqp A
inner join TCustomer B on A.eqp_code=B.code
- where B.btype=@wxcode and A.is_delete<>'1' and B.is_delete<>'1'
- ) B on A.code=B.eqp_code where A.btype=@wxcode and A.is_delete<>'1'";
+ where A.step_code=@stepcode and B.type=@wxcode and A.is_delete<>'1' and B.is_delete<>'1'
+ ) B on A.code=B.eqp_code where A.type=@wxcode and A.is_delete<>'1'";
+ dynamicParams.Add("@stepcode", stepcode);
dynamicParams.Add("@wxcode", rout.code);
var data0 = DapperHelper.selectdata(sql, dynamicParams);
for (int k = 0; k < data0.Rows.Count; k++)
@@ -2014,12 +2030,12 @@
try
{
//閫氳繃浜у搧缂栫爜鏌ユ壘鍏宠仈鐨勫伐鑹鸿矾绾夸俊鎭�
- sql = @"select B.stepcode as code,B.stepname as name
+ sql = @"select B.stepcode as code,B.stepname as name,B.flwtype as flag
from TFlw_Rtdt A
inner join TStep B on A.step_code=B.stepcode
where A.rout_code=@routecode and B.is_delete<>'1' and A.is_delete<>'1'";
dynamicParams.Add("@routecode", routecode);
- var data = DapperHelper.select<ObjectData>(sql, dynamicParams);
+ var data = DapperHelper.select<StepDefect>(sql, dynamicParams);
mes.code = "200";
mes.Message = "鏌ヨ鎴愬姛!";
mes.data = data;
@@ -2064,29 +2080,81 @@
#endregion
#region[鏍规嵁宸ュ簭绾跨紪鐮佹煡鎵惧叧鑱旇澶囬泦鍚圿
- public static ToMessage StepSelectEqpList(string partcode, string routecode, string stepcode, int startNum, int endNum, string prop, string order)
+ public static ToMessage StepSelectEqpList(string partcode, string routecode, string stepcode,string steptype, int startNum, int endNum, string prop, string order)
{
var dynamicParams = new DynamicParameters();
- string search = "";
+ string search = "", sql = "";
+ int total = 0;
try
{
// --------------鏌ヨ鎸囧畾鏁版嵁--------------
- var total = 0; //鎬绘潯鏁�
- var sql = @"select B.code as eqpcode,B.name as eqpname,B.wksp_code,T.org_name as wksp_name,A.eqp_value,A.stand_value,A.cavity_qty,A.unprice
+ if (steptype == "Z") //鑷埗宸ュ簭
+ {
+ total = 0; //鎬绘潯鏁�
+ //sql = @"select B.code as eqpcode,B.name as eqpname,B.wksp_code,T.org_name as wksp_name,A.eqp_value,A.stand_value,A.cavity_qty,A.unprice
+ // from (
+ // select materiel_code, eqp_code,eqp_value,stand_value,cavity_qty,unprice from TPrteEqp_Stad
+ // where materiel_code=@partcode and route_code=@routecode and step_code=@stepcode
+ // union all
+ // select @partcode as materiel_code,eqp_code,'0' as eqp_value,'0' as stand_value,'0' as cavity_qty,'0' as unprice
+ // from TFlw_Rteqp where step_code=@stepcode and style='E' and @partcode+eqp_code+step_code not in(select materiel_code+eqp_code+step_code from TPrteEqp_Stad)
+ // ) A
+ // left join TEqpInfo B on A.eqp_code=B.code
+ // left join TOrganization T on B.wksp_code=T.org_code
+ // left join TMateriel_Info C on A.materiel_code=C.partcode
+ // where B.is_delete<>'1' and T.is_delete<>'1' and C.is_delete<>'1' ";
+
+ sql = @"select B.code as eqpcode,B.name as eqpname,B.wksp_code,T.org_name as wksp_name,A.eqp_value,A.stand_value,A.cavity_qty,A.unprice
from (
select materiel_code, eqp_code,eqp_value,stand_value,cavity_qty,unprice from TPrteEqp_Stad
where materiel_code=@partcode and route_code=@routecode and step_code=@stepcode
union all
- select @partcode as materiel_code,eqp_code,'0' as eqp_value,'0' as stand_value,'0' as cavity_qty,'0' as unprice
- from TFlw_Rteqp where step_code=@stepcode and style='E' and @partcode+eqp_code+step_code not in(select materiel_code+eqp_code+step_code from TPrteEqp_Stad)
+ select @partcode as materiel_code,C.eqp_code,'0' as eqp_value,'0' as stand_value,'0' as cavity_qty,'0' as unprice
+ 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 and B.step_code=@stepcode and style='E' and @partcode+A.code+C.eqp_code+B.step_code
+ not in(select materiel_code+route_code+eqp_code+step_code from TPrteEqp_Stad where materiel_code=@partcode and route_code=@routecode and step_code=@stepcode)
) A
left join TEqpInfo B on A.eqp_code=B.code
left join TOrganization T on B.wksp_code=T.org_code
left join TMateriel_Info C on A.materiel_code=C.partcode
- where B.is_delete<>'1' and T.is_delete<>'1' and C.is_delete<>'1' ";
- dynamicParams.Add("@partcode", partcode);
- dynamicParams.Add("@routecode", routecode);
- dynamicParams.Add("@stepcode", stepcode);
+ where B.is_delete<>'1' and T.is_delete<>'1' and C.is_delete<>'1'";
+ dynamicParams.Add("@partcode", partcode);
+ dynamicParams.Add("@routecode", routecode);
+ dynamicParams.Add("@stepcode", stepcode);
+ }
+ else //澶栧崗宸ュ簭
+ {
+ total = 0; //鎬绘潯鏁�
+ //sql = @"select B.code as eqpcode,B.name as eqpname,'' as wksp_code,'' as wksp_name,A.eqp_value,A.stand_value,A.cavity_qty,A.unprice
+ // from (
+ // select materiel_code, eqp_code,eqp_value,stand_value,cavity_qty,unprice from TPrteEqp_Stad
+ // where materiel_code=@partcode and route_code=@routecode and step_code=@stepcode
+ // union all
+ // select @partcode as materiel_code,eqp_code,'0' as eqp_value,'0' as stand_value,'0' as cavity_qty,'0' as unprice
+ // from TFlw_Rteqp where step_code=@stepcode and style='W' and @partcode+eqp_code+step_code not in(select materiel_code+eqp_code+step_code from TPrteEqp_Stad)
+ // ) A
+ // left join TCustomer B on A.eqp_code=B.code
+ // where B.is_delete<>'1'";
+ sql = @"select B.code as eqpcode,B.name as eqpname,'' as wksp_code,'' as wksp_name,A.eqp_value,A.stand_value,A.cavity_qty,A.unprice
+ from (
+ select materiel_code, eqp_code,eqp_value,stand_value,cavity_qty,unprice from TPrteEqp_Stad
+ where materiel_code=@partcode and route_code=@routecode and step_code=@stepcode
+ union all
+ select @partcode as materiel_code,C.eqp_code,'0' as eqp_value,'0' as stand_value,'0' as cavity_qty,'0' as unprice
+ 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 and B.step_code=@stepcode and style='W' and @partcode+A.code+C.eqp_code+B.step_code
+ not in(select materiel_code+route_code+eqp_code+step_code from TPrteEqp_Stad where materiel_code=@partcode and route_code=@routecode and step_code=@stepcode)
+ ) A
+ left join TCustomer B on A.eqp_code=B.code
+ where B.is_delete<>'1'";
+ dynamicParams.Add("@partcode", partcode);
+ dynamicParams.Add("@routecode", routecode);
+ dynamicParams.Add("@stepcode", stepcode);
+ }
var data = DapperHelper.GetPageList<object>(sql, dynamicParams, prop, order, startNum, endNum, out total);
mes.code = "200";
mes.Message = "鏌ヨ鎴愬姛!";
--
Gitblit v1.9.3