| | |
| | | using Newtonsoft.Json.Linq; |
| | | using Newtonsoft.Json; |
| | | using Newtonsoft.Json.Linq; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | |
| | | using System.Web; |
| | | using System.Web.Http; |
| | | using VueWebApi.DLL.BLL; |
| | | using VueWebApi.Models; |
| | | using VueWebApi.Tools; |
| | | |
| | | namespace VueWebApi.Controllers |
| | |
| | | string taskqty = HttpContext.Current.Request["taskqty"].ToString();//任塿°é |
| | | string startqty = HttpContext.Current.Request["startqty"].ToString();//å¼å·¥æ°é |
| | | string reportqty = HttpContext.Current.Request["reportqty"].ToString();//æ¥å·¥å·¥æ°é |
| | | string ngqty = HttpContext.Current.Request["ngqty"].ToString();//ä¸è¯æ°é |
| | | string badcode = HttpContext.Current.Request["badcode"].ToString();//ä¸è¯åå ç¼ç |
| | | string defectlist = HttpContext.Current.Request["defectlist"].ToString();//ä¸è¯æ±æ» |
| | | string remarks = HttpContext.Current.Request["remarks"].ToString();//夿³¨ |
| | | string username = HttpContext.Current.Request["admin"].ToString();//æä½äººå |
| | | mes = ProductionManagementBLL.SavaMesOrderStepReport(mesordercode, partcode, stepseq, stepcode, eqpcode, inbarcode, reckway,usergroupcode, reportuser, taskqty, startqty, reportqty, ngqty, badcode, remarks, username); |
| | | List<ReportDefectList> defectobjs = JsonConvert.DeserializeObject<List<ReportDefectList>>(defectlist); |
| | | mes = ProductionManagementBLL.SavaMesOrderStepReport(mesordercode, partcode, stepseq, stepcode, eqpcode, inbarcode, reckway,usergroupcode, reportuser, taskqty, startqty, reportqty, defectobjs, remarks, username); |
| | | return TJson.toJson(mes); |
| | | } |
| | | #endregion |
| | |
| | | string inuser = HttpContext.Current.Request["inuser"].ToString();//æ¶æäººå |
| | | string taskqty = HttpContext.Current.Request["taskqty"].ToString();//任塿°é |
| | | string sqty = HttpContext.Current.Request["sqty"].ToString();//æ¶ææ°é |
| | | string ngqty = HttpContext.Current.Request["ngqty"].ToString();//ä¸è¯æ°é |
| | | string badcode = HttpContext.Current.Request["badcode"].ToString();//ä¸è¯åå ç¼ç |
| | | string defectlist = HttpContext.Current.Request["defectlist"].ToString();//ä¸è¯æ±æ» |
| | | string remarks = HttpContext.Current.Request["remarks"].ToString();//夿³¨ |
| | | string username = HttpContext.Current.Request["admin"].ToString();//æä½äººå |
| | | mes = ProductionManagementBLL.SavaMesOrderStepIn(mesordercode, partcode, stepseq, stepcode, wxcode, inbarcode, inuser, taskqty, sqty, ngqty, badcode, remarks, username); |
| | | List<ReportDefectList> defectobjs = JsonConvert.DeserializeObject<List<ReportDefectList>>(defectlist); |
| | | mes = ProductionManagementBLL.SavaMesOrderStepIn(mesordercode, partcode, stepseq, stepcode, wxcode, inbarcode, inuser, taskqty, sqty, defectobjs, remarks, username); |
| | | return TJson.toJson(mes); |
| | | } |
| | | #endregion |
| | |
| | | { |
| | | [RoutePrefix(prefix: "api/ProductionManagement")] |
| | | [ControllerGroup("ç产管ç", "å¨çº¿æ¥å£")] |
| | | //[ChannelActionFilter] |
| | | [ChannelActionFilter] |
| | | public class ProductionManagementController : ApiController |
| | | { |
| | | //å®ä¹å
¨å±ä¿¡æ¯è¿ååé |
| | |
| | | string taskqty = obj["taskqty"].ToString(); //任塿°é |
| | | string startqty = obj["startqty"].ToString(); //å¼å·¥æ°é |
| | | string reportqty = obj["reportqty"].ToString(); //æ¥å·¥å·¥æ°é |
| | | string ngqty = obj["ngqty"].ToString(); //ä¸è¯æ°é |
| | | string badcode = obj["badcode"].ToString(); //ä¸è¯åå ç¼ç |
| | | string defectlist= obj["defectlist"].ToString();//ä¸è¯æ±æ» |
| | | string remarks = obj["remarks"].ToString(); //夿³¨ |
| | | var username = HttpContext.Current.Request.Cookies["admin"].Value.ToString(); //æä½äººå |
| | | mes = ProductionManagementBLL.SavaMesOrderStepReport(mesordercode, partcode, stepseq, stepcode, eqpcode, inbarcode, reckway, usergroupcode, reportuser, taskqty, startqty, reportqty, ngqty, badcode, remarks, username); |
| | | List<ReportDefectList> defectobjs = JsonConvert.DeserializeObject<List<ReportDefectList>>(defectlist); |
| | | mes = ProductionManagementBLL.SavaMesOrderStepReport(mesordercode, partcode, stepseq, stepcode, eqpcode, inbarcode, reckway, usergroupcode, reportuser, taskqty, startqty, reportqty, defectobjs, remarks, username); |
| | | return TJson.toJson(mes); |
| | | } |
| | | #endregion |
| | |
| | | string inuser = obj["inuser"].ToString(); //æ¶æäººå |
| | | string taskqty = obj["taskqty"].ToString(); //任塿°é |
| | | string sqty = obj["sqty"].ToString(); //æ¶ææ°é |
| | | string ngqty = obj["ngqty"].ToString(); //ä¸è¯æ°é |
| | | string badcode = obj["badcode"].ToString(); //ä¸è¯åå ç¼ç |
| | | string defectlist = obj["defectlist"].ToString();//ä¸è¯æ±æ» |
| | | string remarks = obj["remarks"].ToString(); //夿³¨ |
| | | var username = HttpContext.Current.Request.Cookies["admin"].Value.ToString(); //æä½äººå |
| | | mes = ProductionManagementBLL.SavaMesOrderStepIn(mesordercode, partcode, stepseq, stepcode, wxcode, inbarcode, inuser, taskqty, sqty, ngqty, badcode, remarks, username); |
| | | List<ReportDefectList> defectobjs = JsonConvert.DeserializeObject<List<ReportDefectList>>(defectlist); |
| | | mes = ProductionManagementBLL.SavaMesOrderStepIn(mesordercode, partcode, stepseq, stepcode, wxcode, inbarcode, inuser, taskqty, sqty, defectobjs, remarks, username); |
| | | return TJson.toJson(mes); |
| | | } |
| | | #endregion |
| | |
| | | #endregion |
| | | |
| | | #region[çäº§å¼æ¥å·¥,æ¥å·¥æäº¤] |
| | | public static ToMessage SavaMesOrderStepReport(string mesordercode, string partcode, string stepseq, string stepcode, string eqpcode,string inbarcode, string reckway, string usergroupcode, string reportuser, string taskqty,string startqty, string reportqty,string ngqty, string badcode,string remarks, string username) |
| | | public static ToMessage SavaMesOrderStepReport(string mesordercode, string partcode, string stepseq, string stepcode, string eqpcode,string inbarcode, string reckway, string usergroupcode, string reportuser, string taskqty,string startqty, string reportqty, List<ReportDefectList> defectobjs, string remarks, string username) |
| | | { |
| | | return ProductionManagementDAL.SavaMesOrderStepReport(mesordercode, partcode, stepseq, stepcode, eqpcode, inbarcode, reckway,usergroupcode, reportuser, taskqty, startqty, reportqty, ngqty, badcode, remarks, username); |
| | | return ProductionManagementDAL.SavaMesOrderStepReport(mesordercode, partcode, stepseq, stepcode, eqpcode, inbarcode, reckway,usergroupcode, reportuser, taskqty, startqty, reportqty,defectobjs, remarks, username); |
| | | } |
| | | #endregion |
| | | |
| | |
| | | #endregion |
| | | |
| | | #region[çäº§å¼æ¥å·¥, æ¶ææäº¤] |
| | | public static ToMessage SavaMesOrderStepIn(string mesordercode, string partcode, string stepseq, string stepcode, string wxcode,string inbarcode, string inuser, string taskqty, string sqty, string ngqty, string badcode,string remarks, string username) |
| | | public static ToMessage SavaMesOrderStepIn(string mesordercode, string partcode, string stepseq, string stepcode, string wxcode,string inbarcode, string inuser, string taskqty, string sqty, List<ReportDefectList> defectobjs, string remarks, string username) |
| | | { |
| | | return ProductionManagementDAL.SavaMesOrderStepIn(mesordercode, partcode, stepseq, stepcode, wxcode, inbarcode, inuser, taskqty, sqty, ngqty, badcode, remarks, username); |
| | | return ProductionManagementDAL.SavaMesOrderStepIn(mesordercode, partcode, stepseq, stepcode, wxcode, inbarcode, inuser, taskqty, sqty,defectobjs, remarks, username); |
| | | } |
| | | #endregion |
| | | |
| | |
| | | else |
| | | { |
| | | //ä¿®æ¹ç¨æ·ç»è¡¨ |
| | | sql = @"update TGroup see group_name=@groupename,lm_user=@lm_user,lm_date=@lm_date,description=@description,torg_code=@torg_code where group_code=@groupcode"; |
| | | sql = @"update TGroup set group_name=@groupename,lm_user=@lm_user,lm_date=@lm_date,description=@description,torg_code=@torg_code where group_code=@groupcode"; |
| | | list.Add(new |
| | | { |
| | | str = sql, |
| | |
| | | } |
| | | sql = @"delete TGroup where group_code=@UserGrupCode"; |
| | | list.Add(new { str = sql, parm = new { UserGrupCode = UserGrupCode } }); |
| | | sql = @"delete TGroupUser where group_code=@UserGrupCode"; |
| | | list.Add(new { str = sql, parm = new { UserGrupCode = UserGrupCode } }); |
| | | |
| | | bool aa = DapperHelper.DoTransaction(list); |
| | | if (aa) |
| | |
| | | try |
| | | { |
| | | //è·å设å¤ç±»åæ°æ® |
| | | sql = @"select code,name from T_Dict where dict_type='CHLX' "; |
| | | sql = @"select code,name,iparent_id from T_Dict where dict_type='CHLX' "; |
| | | var data = DapperHelper.selecttable(sql); |
| | | mes.code = "200"; |
| | | mes.Message = "æ¥è¯¢æå!"; |
| | |
| | | public static ToMessage InventoryFileSelect(string stu_torgcode,string stu_torgtypecode,string partcode, string partname, string partspec, string stocktypecode, string materialtypecode, string storehousecode, int startNum, int endNum, string prop, string order) |
| | | { |
| | | var dynamicParams = new DynamicParameters(); |
| | | string search0 = ""; |
| | | string search = ""; |
| | | string search1 = ""; |
| | | try |
| | |
| | | } |
| | | if (stocktypecode != "" && stocktypecode != null) |
| | | { |
| | | search += "and D.code=@stocktypecode "; |
| | | search0+= " where code = @stocktypecode"; |
| | | search += " and CTE.code <>@stocktypecode and CTE.iparent_id<>@stocktypecode and CTE.dict_type='CHLX' "; |
| | | dynamicParams.Add("@stocktypecode", stocktypecode); |
| | | } |
| | | if (materialtypecode != "" && materialtypecode != null) |
| | |
| | | } |
| | | // --------------æ¥è¯¢æå®æ°æ®-------------- |
| | | var total = 0; //æ»æ¡æ° |
| | | var sql = @"select A.id,A.partcode,A.partname,A.partspec,A.uom_code,B.name as uom_name,D.code as stocktypecode,D.name as stocktypename, |
| | | C.code as materialtypecode,C.name as materialtypename,A.stck_code,T.name as stck_name,A.maxqty,A.minqty,U.username as lm_user, |
| | | //var sql = @"select A.id,A.partcode,A.partname,A.partspec,A.uom_code,B.name as uom_name,D.code as stocktypecode,D.name as stocktypename, |
| | | // C.code as materialtypecode,C.name as materialtypename,A.stck_code,T.name as stck_name,A.maxqty,A.minqty,U.username as lm_user, |
| | | // A.lm_date,(case when isnull(M.materiel_code,'')='' then 'N' else 'Y' end) as proute_id,A.is_batchno,A.is_fifo,A.is_incheck,A.is_outcheck |
| | | // from TMateriel_Info A |
| | | // left join TUom B on A.uom_code=B.code |
| | | // left join TMateriel_Type C on A.materieltype_code=C.code |
| | | // left join T_Dict D on A.stocktype_code=D.code and D.dict_type='CHLX' |
| | | // left join T_Sec_Stck T on A.stck_code=T.code |
| | | // left join TUser U on A.lm_user=U.usercode |
| | | // left join ( |
| | | // select distinct materiel_code from TMateriel_Route M |
| | | // left join TOrganization F on M.torg_code=F.org_code |
| | | // left join TOrganization as L on F.parent_id=L.id |
| | | // where 1=1 "+search1+") M on A.partcode=M.materiel_code where A.is_delete<>'1' " + search; |
| | | var sql0 = @"WITH CTE AS ( |
| | | SELECT code,name,iparent_id,dict_type |
| | | FROM T_Dict " + search0 + " "; |
| | | sql0 += @"UNION ALL |
| | | SELECT t.code,t.name,t.iparent_id,t.dict_type |
| | | FROM T_Dict t |
| | | INNER JOIN CTE c ON c.code = t.iparent_id) |
| | | SELECT COUNT(1) as total FROM ( |
| | | SELECT distinct A.id,A.partcode,A.partname,A.partspec,A.uom_code,B.name as uom_name,D.code as stocktypecode,D.name as stocktypename,D.iparent_id, |
| | | A.stck_code,T.name as stck_name,A.maxqty,A.minqty,U.username as lm_user, |
| | | A.lm_date,(case when isnull(M.materiel_code,'')='' then 'N' else 'Y' end) as proute_id,A.is_batchno,A.is_fifo,A.is_incheck,A.is_outcheck |
| | | from TMateriel_Info A |
| | | FROM CTE |
| | | right join TMateriel_Info A on CTE.code=A.stocktype_code |
| | | left join TUom B on A.uom_code=B.code |
| | | left join TMateriel_Type C on A.materieltype_code=C.code |
| | | left join T_Dict D on A.stocktype_code=D.code and D.dict_type='CHLX' |
| | | left join T_Dict D on A.stocktype_code=D.code |
| | | left join T_Sec_Stck T on A.stck_code=T.code |
| | | left join TUser U on A.lm_user=U.usercode |
| | | left join ( |
| | | select distinct materiel_code from TMateriel_Route M |
| | | left join TOrganization F on M.torg_code=F.org_code |
| | | left join TOrganization as L on F.parent_id=L.id |
| | | where 1=1 "+search1+") M on A.partcode=M.materiel_code where A.is_delete<>'1' " + search; |
| | | var data = DapperHelper.GetPageList<object>(sql, dynamicParams, prop, order, startNum, endNum, out total); |
| | | where 1=1 " + search1 + ") M on A.partcode=M.materiel_code where A.is_delete<>'1' " + search+") AS Result"; |
| | | var data0 = DapperHelper.selectdata(sql0, dynamicParams); |
| | | if (data0.Rows.Count > 0) |
| | | { |
| | | total = Convert.ToInt32(data0.Rows[0]["total"].ToString()); |
| | | } |
| | | else |
| | | { |
| | | total = 0; |
| | | } |
| | | |
| | | var sql = @"WITH CTE AS ( |
| | | SELECT code,name,iparent_id,dict_type |
| | | FROM T_Dict "+search0+" "; |
| | | sql += @"UNION ALL |
| | | SELECT t.code,t.name,t.iparent_id,t.dict_type |
| | | FROM T_Dict t |
| | | INNER JOIN CTE c ON c.code = t.iparent_id) |
| | | SELECT * FROM(SELECT *,ROW_NUMBER() OVER(ORDER BY lm_date desc) AS RowNum |
| | | FROM( |
| | | SELECT distinct A.id,A.partcode,A.partname,A.partspec,A.uom_code,B.name as uom_name,D.code as stocktypecode,D.name as stocktypename,D.iparent_id, |
| | | A.stck_code,T.name as stck_name,A.maxqty,A.minqty,U.username as lm_user, |
| | | A.lm_date,(case when isnull(M.materiel_code,'')='' then 'N' else 'Y' end) as proute_id,A.is_batchno,A.is_fifo,A.is_incheck,A.is_outcheck |
| | | FROM CTE |
| | | right join TMateriel_Info A on CTE.code=A.stocktype_code |
| | | left join TUom B on A.uom_code=B.code |
| | | left join T_Dict D on A.stocktype_code=D.code |
| | | left join T_Sec_Stck T on A.stck_code=T.code |
| | | left join TUser U on A.lm_user=U.usercode |
| | | left join ( |
| | | select distinct materiel_code from TMateriel_Route M |
| | | left join TOrganization F on M.torg_code=F.org_code |
| | | left join TOrganization as L on F.parent_id=L.id |
| | | where 1=1 " + search1+") M on A.partcode=M.materiel_code where A.is_delete<>'1' "+search+ " ) AS Temp) AS Result WHERE RowNum >= "+ startNum + " AND RowNum <="+ endNum + " ORDER BY "+ prop + " "+order+""; |
| | | var data = DapperHelper.selectdata(sql, dynamicParams); |
| | | mes.code = "200"; |
| | | mes.Message = "æ¥è¯¢æå!"; |
| | | mes.count = total; |
| | | mes.data = data.ToList(); |
| | | mes.data = data; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | |
| | | } |
| | | //æ ¹æ®æ¡ä»¶æ¥è¯¢å·¥åå·¥åºæ¥å·¥(æ¶æ)è®°å½,ä¸ä¸è¯æ°é大äº0 |
| | | //åå¨è¿ç¨å |
| | | sql = @"h_p_IFCLD_MesReportDefectHandleSelect"; |
| | | //sql = @"h_p_IFCLD_MesReportDefectHandleSelect"; |
| | | sql = @"select MM.record_id as m_id,MM.wo_code,A.materiel_code,S.seq,MM.step_code,T.stepname,A.id, |
| | | S.plan_qty,A.good_qty as report_qty,MM.defect_qty as ng_qty,A.bad_qty as badqty,'Z' as style,MM.verify, |
| | | MM.defect_code,STUFF((SELECT ',' + P.name |
| | | FROM TDefect P |
| | | WHERE CHARINDEX(',' + P.code + ',', ',' + MM.defect_code + ',') > 0 |
| | | FOR XML PATH('')), 1, 1, '') AS defect_name |
| | | from CSR_WorkRecord_Defect MM |
| | | inner join TK_Wrk_Record A on MM.record_id=a.id |
| | | inner join TK_Wrk_Step S on A.wo_code=S.wo_code and A.step_code=S.step_code |
| | | inner join TStep T on MM.step_code=T.stepcode |
| | | where MM.wo_code=@ordercode and MM.step_code=@stepcode and MM.style='B' and A.style='B' and A.ng_qty>0"; |
| | | dynamicParams1.Add("@ordercode", ordercode); |
| | | dynamicParams1.Add("@stepcode", stepcode); |
| | | DataTable dt = DapperHelper.selectProcedure(sql, dynamicParams1); |
| | | DataTable dt = DapperHelper.selectdata(sql, dynamicParams1); |
| | | if (dt.Rows.Count > 0) |
| | | { |
| | | list.Add("data1", rt); |
| | |
| | | #endregion |
| | | |
| | | #region[çäº§å¼æ¥å·¥,æ¥å·¥æäº¤] |
| | | public static ToMessage SavaMesOrderStepReport(string mesordercode, string partcode, string stepseq, string stepcode, string eqpcode, string inbarcode, string reckway, string usergroupcode, string reportuser, string taskqty, string startqty, string reportqty, string ngqty, string badcode, string remarks, string username) |
| | | public static ToMessage SavaMesOrderStepReport(string mesordercode, string partcode, string stepseq, string stepcode, string eqpcode, string inbarcode, string reckway, string usergroupcode, string reportuser, string taskqty, string startqty, string reportqty, List<ReportDefectList> defectobjs, string remarks, string username) |
| | | { |
| | | var sql = ""; |
| | | //string[] arra = new string[] { }; |
| | | decimal ngqty = 0; |
| | | string[] arra1 = new string[] { }; |
| | | List<object> list = new List<object>(); |
| | | var dynamicParams = new DynamicParameters(); |
| | |
| | | string date = DateTime.Now.ToString(); //è·åç³»ç»æ¶é´ |
| | | //è·åæ¥å·¥äººåãåé
æ¯ä¾ |
| | | JArray arra = (JArray)Newtonsoft.Json.JsonConvert.DeserializeObject(reportuser); |
| | | if (ngqty != "" || ngqty != "0") |
| | | //夿æ¯å¦æä¸è¯æ°æ® |
| | | var groupedItems = defectobjs.GroupBy(item => item.defect_code) // æç¼ç codeåç» |
| | | .Select(group => new { defect_code = group.Key, badqty = group.Sum(item =>Convert.ToDecimal(item.badqty)) }).ToList(); // æ±æ»æ°éqty |
| | | if (groupedItems.Count <= 0) |
| | | { |
| | | //æªåä¸è¯åå |
| | | arra1 = badcode.Split(';'); |
| | | ngqty = 0; |
| | | } |
| | | |
| | | else |
| | | { |
| | | //æ±æ»ä¸è¯æ°é |
| | | ngqty = groupedItems.Sum(item => Convert.ToDecimal(item.badqty)); |
| | | } |
| | | list.Clear(); |
| | | //夿æ¯å¦ææ¥å·¥è®°å½(æï¼ä¿®æ¹ æ ï¼æ°å¢) |
| | | sql = @"select * from TK_Wrk_Record where wo_code=@wo_code and step_code=@step_code and style='B'"; |
| | |
| | | //è·å主表æå¤§ID |
| | | sql = @"select ISNULL(IDENT_CURRENT('TK_Wrk_Record')+1,1) as id"; |
| | | var dt = DapperHelper.selecttable(sql); |
| | | |
| | | //åå
¥å¼æ¥å·¥è®°å½è¡¨ |
| | | sql = @"insert into TK_Wrk_Record(wo_code,step_seq,step_code,eqp_code,materiel_code,task_qty,start_qty,good_qty,ng_qty,style,lm_user,lm_date,inbarcode) |
| | | values(@mesordercode,@stepseq,@stepcode,@eqpcode,@partcode,@taskqty,@startqty,@reportqty,@ngqty,@style,@lm_user,@lm_date,@inbarcode)"; |
| | |
| | | }); |
| | | |
| | | } |
| | | if (badcode != "" && ngqty != "0") |
| | | if (groupedItems.Count>0) |
| | | { |
| | | //åå
¥ç¼ºé·è®°å½è¡¨ |
| | | for (int i = 0; i < arra1.Length; i++) |
| | | for (int i = 0; i < groupedItems.Count; i++) |
| | | { |
| | | sql = @"insert into CSR_WorkRecord_Defect(record_id,wo_code,partnumber,step_seq,step_code,defect_qty,defect_code,remarks,style,lm_user,lm_date) |
| | | values(@record_id,@wo_code,@partcode,@stepseq,@stepcode,@ngqty,@defect_code,@remarks,@style,@lm_user,@lm_date)"; |
| | | list.Add(new { str = sql, parm = new { record_id = int.Parse(dt.Rows[0]["ID"].ToString()), wo_code = mesordercode, partcode = partcode, stepseq = stepseq, stepcode = stepcode, ngqty = ngqty, defect_code = arra1[i], remarks = remarks, style = "B", lm_user = username, lm_date = date } }); |
| | | list.Add(new { str = sql, parm = new { record_id = int.Parse(dt.Rows[0]["ID"].ToString()), wo_code = mesordercode, partcode = partcode, stepseq = stepseq, stepcode = stepcode, ngqty = groupedItems[i].badqty, defect_code = groupedItems[i].defect_code, remarks = remarks, style = "B", lm_user = username, lm_date = date } }); |
| | | |
| | | } |
| | | } |
| | |
| | | }); |
| | | |
| | | } |
| | | if (badcode != "" && ngqty != "0") |
| | | if (groupedItems.Count > 0) |
| | | { |
| | | //åå
¥ç¼ºé·è®°å½è¡¨ |
| | | for (int i = 0; i < arra1.Length; i++) |
| | | for (int i = 0; i < groupedItems.Count; i++) |
| | | { |
| | | sql = @"insert into CSR_WorkRecord_Defect(record_id,wo_code,partnumber,step_seq,step_code,defect_qty,defect_code,remarks,style,lm_user,lm_date) |
| | | values(@record_id,@wo_code,@partcode,@stepseq,@stepcode,@ngqty,@defect_code,@remarks,@style,@lm_user,@lm_date)"; |
| | | list.Add(new { str = sql, parm = new { record_id = int.Parse(dt.Rows[0]["ID"].ToString()), wo_code = mesordercode, partcode = partcode, stepseq = stepseq, stepcode = stepcode, ngqty = ngqty, defect_code = arra1[i], remarks = remarks, style = "B", lm_user = username, lm_date = date } }); |
| | | list.Add(new { str = sql, parm = new { record_id = int.Parse(dt.Rows[0]["ID"].ToString()), wo_code = mesordercode, partcode = partcode, stepseq = stepseq, stepcode = stepcode, ngqty = groupedItems[i].badqty, defect_code = groupedItems[i].defect_code, remarks = remarks, style = "B", lm_user = username, lm_date = date } }); |
| | | |
| | | } |
| | | } |
| | |
| | | #endregion |
| | | |
| | | #region[çäº§å¼æ¥å·¥, æ¶ææäº¤] |
| | | public static ToMessage SavaMesOrderStepIn(string mesordercode, string partcode, string stepseq, string stepcode, string wxcode, string inbarcode, string inuser, string taskqty, string sqty, string ngqty, string badcode, string remarks, string username) |
| | | public static ToMessage SavaMesOrderStepIn(string mesordercode, string partcode, string stepseq, string stepcode, string wxcode, string inbarcode, string inuser, string taskqty, string sqty, List<ReportDefectList> defectobjs, string remarks, string username) |
| | | { |
| | | var sql = ""; |
| | | string[] arra1 = new string[] { }; |
| | | decimal ngqty = 0; |
| | | List<object> list = new List<object>(); |
| | | var dynamicParams = new DynamicParameters(); |
| | | try |
| | | { |
| | | string date = DateTime.Now.ToString(); //è·åç³»ç»æ¶é´ |
| | | //æªåä¸è¯åå |
| | | if (ngqty != "" || ngqty != "0") |
| | | //夿æ¯å¦æä¸è¯æ°æ® |
| | | var groupedItems = defectobjs.GroupBy(item => item.defect_code) // æç¼ç codeåç» |
| | | .Select(group => new { defect_code = group.Key, badqty = group.Sum(item => Convert.ToDecimal(item.badqty)) }).ToList(); // æ±æ»æ°éqty |
| | | if (groupedItems.Count <= 0) |
| | | { |
| | | //æªåä¸è¯åå |
| | | arra1 = badcode.Split(';'); |
| | | ngqty = 0; |
| | | } |
| | | else |
| | | { |
| | | //æ±æ»ä¸è¯æ°é |
| | | ngqty = groupedItems.Sum(item => Convert.ToDecimal(item.badqty)); |
| | | } |
| | | |
| | | list.Clear(); |
| | |
| | | mes.data = null; |
| | | return mes; |
| | | } |
| | | if ((decimal.Parse(sqty) + decimal.Parse(ngqty)) > decimal.Parse(da.Rows[0]["FQTY"].ToString())) //æ¶ææ°é+ä¸è¯æ°é>åææ°é |
| | | if ((decimal.Parse(sqty) + ngqty) > decimal.Parse(da.Rows[0]["FQTY"].ToString())) //æ¶ææ°é+ä¸è¯æ°é>åææ°é |
| | | { |
| | | mes.code = "300"; |
| | | mes.count = 0; |
| | |
| | | { |
| | | decimal sum_sqty = data.AsEnumerable().Select(d => d.Field<decimal>("SQTY")).Sum(); //è·åååå·,åå·¥åº,åå¤åä¾åºåæ¶ææ»æ°é |
| | | decimal sum_fqty = da.AsEnumerable().Select(d => d.Field<decimal>("FQTY")).Sum(); //è·åååå·,åå·¥åº,åå¤åä¾åºååææ»æ°é |
| | | if ((sum_sqty + decimal.Parse(sqty) + decimal.Parse(ngqty)) > sum_fqty) //å·²æ¶ææ»æ°+å½åæ¶ææ°é+ä¸è¯æ°é>æ»åææ°é |
| | | if ((sum_sqty + decimal.Parse(sqty) + ngqty) > sum_fqty) //å·²æ¶ææ»æ°+å½åæ¶ææ°é+ä¸è¯æ°é>æ»åææ°é |
| | | { |
| | | mes.code = "300"; |
| | | mes.count = 0; |
| | |
| | | values(@m_id,@wxcode,@in_person,@in_time,@sqty,@ng_qty,@style,@lm_user,@lm_date)"; |
| | | list.Add(new { str = sql, parm = new { m_id = int.Parse(dt.Rows[0]["ID"].ToString()), wxcode = wxcode, in_person = inuser, in_time = date, sqty = sqty, ng_qty = ngqty, style = "S", lm_user = username, lm_date = date } }); |
| | | |
| | | if (badcode != "" && ngqty != "0") |
| | | if (groupedItems.Count>0) |
| | | { |
| | | //åå
¥ç¼ºé·è®°å½è¡¨ |
| | | for (int i = 0; i < arra1.Length; i++) |
| | | for (int i = 0; i < groupedItems.Count; i++) |
| | | { |
| | | sql = @"insert into CSR_WorkRecord_Defect(record_id,wo_code,partnumber,step_seq,step_code,defect_qty,defect_code,remarks,style,lm_user,lm_date) |
| | | values(@record_id,@wo_code,@partcode,@stepseq,@stepcode,@ngqty,@defect_code,@remarks,@style,@lm_user,@lm_date)"; |
| | | list.Add(new { str = sql, parm = new { record_id = int.Parse(dt.Rows[0]["ID"].ToString()), wo_code = mesordercode, partcode = partcode, stepseq = stepseq, stepcode = stepcode, ngqty = ngqty, defect_code = arra1[i], remarks = remarks, style = "S", lm_user = username, lm_date = date } }); |
| | | list.Add(new { str = sql, parm = new { record_id = int.Parse(dt.Rows[0]["ID"].ToString()), wo_code = mesordercode, partcode = partcode, stepseq = stepseq, stepcode = stepcode, ngqty = groupedItems[i].badqty, defect_code = groupedItems[i].defect_code, remarks = remarks, style = "S", lm_user = username, lm_date = date } }); |
| | | |
| | | } |
| | | } |
| | |
| | | values(@m_id,@wxcode,@in_person,@in_time,@sqty,@ng_qty,@style,@lm_user,@lm_date)"; |
| | | list.Add(new { str = sql, parm = new { m_id = int.Parse(dt.Rows[0]["ID"].ToString()), wxcode = wxcode, in_person = inuser, in_time = date, sqty = sqty, ng_qty = ngqty, style = "S", lm_user = username, lm_date = date } }); |
| | | |
| | | if (badcode != "" && ngqty != "0") |
| | | if (groupedItems.Count > 0) |
| | | { |
| | | //åå
¥ç¼ºé·è®°å½è¡¨ |
| | | for (int i = 0; i < arra1.Length; i++) |
| | | for (int i = 0; i < groupedItems.Count; i++) |
| | | { |
| | | sql = @"insert into CSR_WorkRecord_Defect(record_id,wo_code,partnumber,step_seq,step_code,defect_qty,defect_code,remarks,style,lm_user,lm_date) |
| | | values(@record_id,@wo_code,@partcode,@stepseq,@stepcode,@ngqty,@defect_code,@remarks,@style,@lm_user,@lm_date)"; |
| | | list.Add(new { str = sql, parm = new { record_id = int.Parse(dt.Rows[0]["ID"].ToString()), wo_code = mesordercode, partcode = partcode, stepseq = stepseq, stepcode = stepcode, ngqty = ngqty, defect_code = arra1[i], remarks = remarks, style = "S", lm_user = username, lm_date = date } }); |
| | | list.Add(new { str = sql, parm = new { record_id = int.Parse(dt.Rows[0]["ID"].ToString()), wo_code = mesordercode, partcode = partcode, stepseq = stepseq, stepcode = stepcode, ngqty = groupedItems[i].badqty, defect_code = groupedItems[i].defect_code, remarks = remarks, style = "S", lm_user = username, lm_date = date } }); |
| | | |
| | | } |
| | | } |
| | |
| | | { |
| | | if (wkshopcode != "" && wkshopcode != null) |
| | | { |
| | | search += "and W.wkshp_code=@wkshopcode "; |
| | | search += "and AA.wkshp_code=@wkshopcode "; |
| | | dynamicParams.Add("@wkshopcode", wkshopcode); |
| | | } |
| | | if (wocode != "" && wocode != null) |
| | | { |
| | | search += "and A.wo_code like '%'+@wocode+'%' "; |
| | | search += "and AA.wo_code like '%'+@wocode+'%' "; |
| | | dynamicParams.Add("@wocode", wocode); |
| | | } |
| | | if (partcode != "" && partcode != null) |
| | | { |
| | | search += "and M.partcode like '%'+@partcode+'%' "; |
| | | search += "and AA.partcode like '%'+@partcode+'%' "; |
| | | dynamicParams.Add("@partcode", partcode); |
| | | } |
| | | if (partname != "" && partname != null) |
| | | { |
| | | search += "and M.partname like '%'+@partname+'%' "; |
| | | search += "and AA.partname like '%'+@partname+'%' "; |
| | | dynamicParams.Add("@partname", partname); |
| | | } |
| | | if (partspec != "" && partspec != null) |
| | | { |
| | | search += "and M.partspec like '%'+@partspec+'%' "; |
| | | search += "and AA.partspec like '%'+@partspec+'%' "; |
| | | dynamicParams.Add("@partspec", partspec); |
| | | } |
| | | if (stepname != "" && stepname != null) |
| | | { |
| | | search += "and T.stepname like '%'+@stepname+'%' "; |
| | | search += "and AA.stepname like '%'+@stepname+'%' "; |
| | | dynamicParams.Add("@stepname", stepname); |
| | | } |
| | | if (defectcode != "" && defectcode != null) |
| | | { |
| | | search += "and F.code like '%'+@defectcode+'%' "; |
| | | search += "and AA.defect_code like '%'+@defectcode+'%' "; |
| | | dynamicParams.Add("@defectcode", defectcode); |
| | | } |
| | | if (defectname != "" && defectname != null) |
| | | { |
| | | search += "and F.name like '%'+@defectname+'%' "; |
| | | search += "and AA.defect_name like '%'+@defectname+'%' "; |
| | | dynamicParams.Add("@defectname", defectname); |
| | | } |
| | | if (reportname != "" && reportname != null) |
| | | { |
| | | search += "and U.username like '%'+@reportname+'%' "; |
| | | search += "and AA.username like '%'+@reportname+'%' "; |
| | | dynamicParams.Add("@reportname", reportname); |
| | | } |
| | | if (reportopendate != "" && reportopendate != null) |
| | | { |
| | | search += "and A.lm_date between @reportopendate and @reportclosedate "; |
| | | search += "and AA.lm_date between @reportopendate and @reportclosedate "; |
| | | dynamicParams.Add("@reportopendate", reportopendate + " 00:00:00"); |
| | | dynamicParams.Add("@reportclosedate", reportclosedate + " 23:59:59"); |
| | | } |
| | |
| | | search = search.Substring(3);//æªåç´¢å¼2åé¢çå符 |
| | | // --------------æ¥è¯¢æå®æ°æ®-------------- |
| | | var total = 0; //æ»æ¡æ° |
| | | var sql = @"select W.wkshp_code,L.org_name as wkshp_name,A.wo_code,M.partcode,M.partname,M.partspec,T.stepcode,T.stepname,P.plan_qty,A.defect_qty, |
| | | F.code as defect_code,F.name as defect_name,A.style,U.username as lm_user,A.lm_date |
| | | var sql = @"select * from( |
| | | select W.wkshp_code,L.org_name as wkshp_name,A.wo_code,M.partcode,M.partname,M.partspec,T.stepcode,T.stepname,P.plan_qty,A.defect_qty, |
| | | A.defect_code, |
| | | STUFF((SELECT ',' + P.name |
| | | FROM TDefect P |
| | | WHERE CHARINDEX(',' + P.code + ',', ',' + A.defect_code + ',') > 0 |
| | | FOR XML PATH('')), 1, 1, '') AS defect_name, |
| | | A.style,U.username as lm_user,A.lm_date |
| | | from CSR_WorkRecord_Defect A |
| | | inner join TK_Wrk_Step P on A.wo_code=P.wo_code and A.step_code=P.step_code |
| | | left join TMateriel_Info M on A.partnumber=M.partcode |
| | | left join TStep T on A.step_code=T.stepcode |
| | | left join TDefect F on A.defect_code=F.code |
| | | left join TUser U on A.lm_user=U.usercode |
| | | left join TK_Wrk_Man W on A.wo_code=W.wo_code |
| | | left join TOrganization L on W.wkshp_code=L.org_code |
| | | ) as AA |
| | | where " + search; |
| | | var data = DapperHelper.GetPageList<object>(sql, dynamicParams, prop, order, startNum, endNum, out total); |
| | | mes.code = "200"; |
| | |
| | | { |
| | | if (wkshopcode != "" && wkshopcode != null) |
| | | { |
| | | search += "and W.wkshp_code=@wkshopcode "; |
| | | search += "and AA.wkshp_code=@wkshopcode "; |
| | | dynamicParams.Add("@wkshopcode", wkshopcode); |
| | | } |
| | | if (wocode != "" && wocode != null) |
| | | { |
| | | search += "and A.wo_code like '%'+@wocode+'%' "; |
| | | search += "and AA.wo_code like '%'+@wocode+'%' "; |
| | | dynamicParams.Add("@wocode", wocode); |
| | | } |
| | | if (partcode != "" && partcode != null) |
| | | { |
| | | search += "and M.partcode like '%'+@partcode+'%' "; |
| | | search += "and AA.partcode like '%'+@partcode+'%' "; |
| | | dynamicParams.Add("@partcode", partcode); |
| | | } |
| | | if (partname != "" && partname != null) |
| | | { |
| | | search += "and M.partname like '%'+@partname+'%' "; |
| | | search += "and AA.partname like '%'+@partname+'%' "; |
| | | dynamicParams.Add("@partname", partname); |
| | | } |
| | | if (partspec != "" && partspec != null) |
| | | { |
| | | search += "and M.partspec like '%'+@partspec+'%' "; |
| | | search += "and AA.partspec like '%'+@partspec+'%' "; |
| | | dynamicParams.Add("@partspec", partspec); |
| | | } |
| | | if (stepname != "" && stepname != null) |
| | | { |
| | | search += "and T.stepname like '%'+@stepname+'%' "; |
| | | search += "and AA.stepname like '%'+@stepname+'%' "; |
| | | dynamicParams.Add("@stepname", stepname); |
| | | } |
| | | if (defectcode != "" && defectcode != null) |
| | | { |
| | | search += "and F.code like '%'+@defectcode+'%' "; |
| | | search += "and AA.code like '%'+@defectcode+'%' "; |
| | | dynamicParams.Add("@defectcode", defectcode); |
| | | } |
| | | if (defectname != "" && defectname != null) |
| | | { |
| | | search += "and F.name like '%'+@defectname+'%' "; |
| | | search += "and AA.name like '%'+@defectname+'%' "; |
| | | dynamicParams.Add("@defectname", defectname); |
| | | } |
| | | if (reportname != "" && reportname != null) |
| | | { |
| | | search += "and U.username like '%'+@reportname+'%' "; |
| | | search += "and AA.username like '%'+@reportname+'%' "; |
| | | dynamicParams.Add("@reportname", reportname); |
| | | } |
| | | if (reportopendate != "" && reportopendate != null) |
| | | { |
| | | search += "and A.lm_date between @reportopendate and @reportclosedate "; |
| | | search += "and AA.lm_date between @reportopendate and @reportclosedate "; |
| | | dynamicParams.Add("@reportopendate", reportopendate + " 00:00:00"); |
| | | dynamicParams.Add("@reportclosedate", reportclosedate + " 23:59:59"); |
| | | } |
| | |
| | | search = search.Substring(3);//æªåç´¢å¼2åé¢çå符 |
| | | // --------------æ¥è¯¢æå®æ°æ®-------------- |
| | | var total = 0; //æ»æ¡æ° |
| | | var sql = @"select W.wkshp_code as 车é´ç¼ç ,L.org_name as 车é´åç§°,A.wo_code as å·¥åç¼å·,M.partcode as 产åç¼ç ,M.partname as 产ååç§°,M.partspec as 产åè§æ ¼,T.stepcode as å·¥åºç¼ç , |
| | | T.stepname as å·¥åºåç§°,P.plan_qty as 任塿°é,A.defect_qty as ä¸è¯æ°é,F.code as 缺é·ä»£ç ,F.name as 缺é·åç§°, |
| | | (case when A.style='B' then 'æ¥å·¥' when A.style='S' then 'æ¶æ' end) as 'æä½ç±»å',U.username as æä½äººå,A.lm_date as æä½æ¶é´ |
| | | var sql = @"select AA.wkshp_code as 车é´ç¼ç ,AA.wkshp_name as 车é´åç§°,AA.wo_code as å·¥åç¼å·,AA.partcode as 产åç¼ç ,AA.partname as 产ååç§°,AA.partspec as 产åè§æ ¼,AA.stepcode as å·¥åºç¼ç , |
| | | AA.stepname as å·¥åºåç§°,AA.plan_qty as 任塿°é,AA.defect_qty as ä¸è¯æ°é,AA.defect_code as 缺é·ä»£ç ,AA.defect_name as 缺é·åç§°, |
| | | (case when AA.style='B' then 'æ¥å·¥' when AA.style='S' then 'æ¶æ' end) as 'æä½ç±»å',AA.username as æä½äººå,AA.lm_date as æä½æ¶é´ |
| | | from( |
| | | select W.wkshp_code,L.org_name as wkshp_name,A.wo_code,M.partcode,M.partname,M.partspec,T.stepcode,T.stepname,P.plan_qty,A.defect_qty, |
| | | A.defect_code, |
| | | STUFF((SELECT ',' + P.name |
| | | FROM TDefect P |
| | | WHERE CHARINDEX(',' + P.code + ',', ',' + A.defect_code + ',') > 0 |
| | | FOR XML PATH('')), 1, 1, '') AS defect_name, |
| | | A.style,U.username,A.lm_date |
| | | from CSR_WorkRecord_Defect A |
| | | inner join TK_Wrk_Step P on A.wo_code=P.wo_code and A.step_code=P.step_code |
| | | left join TMateriel_Info M on A.partnumber=M.partcode |
| | | left join TStep T on A.step_code=T.stepcode |
| | | left join TDefect F on A.defect_code=F.code |
| | | left join TUser U on A.lm_user=U.usercode |
| | | left join TK_Wrk_Man W on A.wo_code=W.wo_code |
| | | left join TOrganization L on W.wkshp_code=L.org_code |
| | | ) as AA |
| | | where " + search; |
| | | DataTable data = DapperHelper.selectdata(sql, dynamicParams); |
| | | data.TableName = "Table"; //设置DataTableçåç§° |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Web; |
| | | |
| | | namespace VueWebApi.Models |
| | | { |
| | | public class ReportDefectList |
| | | { |
| | | public string badqty { get; set; } |
| | | public string defect_code { get; set; } |
| | | } |
| | | } |
| | |
| | | <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
| | | <PropertyGroup> |
| | | <_PublishTargetUrl>D:\ç½ç«åå¸\MESæ£æ¸
æ²³</_PublishTargetUrl> |
| | | <History>True|2023-08-07T02:34:44.0844087Z;True|2023-08-07T10:28:56.2230477+08:00;True|2023-07-31T11:18:06.9546379+08:00;True|2023-07-03T10:38:22.8080444+08:00;True|2023-06-26T08:15:27.3611577+08:00;True|2023-06-25T15:36:41.8736654+08:00;True|2023-06-25T14:33:49.5287543+08:00;True|2023-06-13T10:24:59.6876648+08:00;</History> |
| | | <History>True|2023-08-16T08:52:02.7063729Z;True|2023-08-11T10:35:11.9236725+08:00;True|2023-08-07T10:34:44.0844087+08:00;True|2023-08-07T10:28:56.2230477+08:00;True|2023-07-31T11:18:06.9546379+08:00;True|2023-07-03T10:38:22.8080444+08:00;True|2023-06-26T08:15:27.3611577+08:00;True|2023-06-25T15:36:41.8736654+08:00;True|2023-06-25T14:33:49.5287543+08:00;True|2023-06-13T10:24:59.6876648+08:00;</History> |
| | | </PropertyGroup> |
| | | <ItemGroup> |
| | | <File Include="Areas/HelpPage/HelpPage.css"> |
| | |
| | | <publishTime>12/24/2021 15:38:29</publishTime> |
| | | </File> |
| | | <File Include="bin/VueWebApi.dll"> |
| | | <publishTime>08/08/2023 10:17:11</publishTime> |
| | | <publishTime>08/16/2023 17:56:41</publishTime> |
| | | </File> |
| | | <File Include="bin/VueWebApi.pdb"> |
| | | <publishTime>08/08/2023 10:17:11</publishTime> |
| | | <publishTime>08/16/2023 17:56:41</publishTime> |
| | | </File> |
| | | <File Include="bin/VueWebApi.xml"> |
| | | <publishTime>08/08/2023 10:17:11</publishTime> |
| | | <publishTime>08/16/2023 17:56:41</publishTime> |
| | | </File> |
| | | <File Include="bin/WebActivatorEx.dll"> |
| | | <publishTime>02/08/2013 16:42:28</publishTime> |
| | |
| | | <Compile Include="Models\ObjectDataCont.cs" /> |
| | | <Compile Include="Models\PartRout.cs" /> |
| | | <Compile Include="Models\ReportDefectHandle.cs" /> |
| | | <Compile Include="Models\ReportDefectList.cs" /> |
| | | <Compile Include="Models\RoleUserSubmit.cs" /> |
| | | <Compile Include="Models\RoutEdit.cs" /> |
| | | <Compile Include="Models\ScanStartReportData.cs" /> |
| | |
| | | 16db473c7cd4741e2f1489189a448a193a8f084b |
| | | 37a4837cde60667993b76a4c5ab1a5593b5b37dc |
| | |
| | | b2c2c9f06449485157f9db847892f5917c4115f5 |
| | | a3528039de7d3c9a92bd6117d6e773fa8a56138f |