1.人员基础资料、班组基础资料接口
2.报工调整查询接口、报工调整获取不良记录接口、报工调整提交接口
| | |
| | | } |
| | | #endregion |
| | | |
| | | #region[人ååºç¡èµæ] |
| | | /// <summary> |
| | | /// 人ååºç¡èµæ |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | [Route(template: "PersonPermissions")] |
| | | [HttpGet] |
| | | public JsonResult PersonPermissions() |
| | | { |
| | | mes = GeneralBasicDataBLL.PersonPermissions(); |
| | | return Json(mes); |
| | | } |
| | | #endregion |
| | | |
| | | #region[çç»æ¥æ¾äººååºç¡èµæ] |
| | | /// <summary> |
| | | /// çç»æ¥æ¾äººååºç¡èµæ |
| | | /// </summary> |
| | | /// <param name="groupcode">çç»ç¼ç </param> |
| | | /// <returns></returns> |
| | | [Route(template: "GroupsPersonPermissions")] |
| | | [HttpGet] |
| | | public JsonResult GroupsPersonPermissions(string groupcode) |
| | | { |
| | | mes = GeneralBasicDataBLL.GroupsPersonPermissions(groupcode); |
| | | return Json(mes); |
| | | } |
| | | #endregion |
| | | |
| | | #region[æé®åºç¡èµæ] |
| | | /// <summary> |
| | |
| | | } |
| | | #endregion |
| | | |
| | | #region[设å¤åºç¡èµæ] |
| | | [Route(template: "EqpPermissions")] |
| | | [HttpGet] |
| | | public JsonResult EqpPermissions() |
| | | { |
| | | mes = GeneralBasicDataBLL.EqpPermissions(); |
| | | return Json(mes); |
| | | } |
| | | #endregion |
| | | |
| | | #region[ä»åºåºç¡èµæ] |
| | | /// <summary> |
| | |
| | | } |
| | | #endregion |
| | | |
| | | #region[缺é·åºç¡èµæ] |
| | | [Route(template: "DefectPermissions")] |
| | | [HttpGet] |
| | | public JsonResult DefectPermissions() |
| | | { |
| | | mes = GeneralBasicDataBLL.DefectPermissions(); |
| | | return Json(mes); |
| | | } |
| | | #endregion |
| | | |
| | | #region[徿¥åä½åºç¡èµæ] |
| | | /// <summary> |
| | | /// 徿¥åä½åºç¡èµæ |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | [Route(template: "CustomerPermissions")] |
| | | [HttpGet] |
| | | public JsonResult CustomerPermissions() |
| | | { |
| | | mes = GeneralBasicDataBLL.CustomerPermissions(); |
| | | return Json(mes); |
| | | } |
| | | #endregion |
| | | } |
| | | } |
| | |
| | | } |
| | | #endregion |
| | | |
| | | #region[çæç©ææ ç¾æ¡ç (æ¯æ¬¡è·åææ°,Appå¯ä½¿ç¨)] |
| | | #region[çæç³»ç»æ¡ç (èªå®ä¹),çæç©ææ ç¾æ¡ç (æ¯æ¬¡è·åææ°,Appå¯ä½¿ç¨)] |
| | | /// <summary> |
| | | /// çæç©ææ ç¾æ¡ç (æ¯æ¬¡è·åææ°,Appå¯ä½¿ç¨) |
| | | /// çæç³»ç»æ¡ç (èªå®ä¹),çæç©ææ ç¾æ¡ç (æ¯æ¬¡è·åææ°,Appå¯ä½¿ç¨) |
| | | /// </summary> |
| | | /// <param name="rightcode">åè½ç¼ç </param> |
| | | /// <param name="partcode">ç©æç¼ç </param> |
| | |
| | | using System.Threading.Tasks; |
| | | using VueWebCoreApi.DLL.BLL; |
| | | using VueWebCoreApi.Models; |
| | | using VueWebCoreApi.Models.UpdateReport; |
| | | using VueWebCoreApi.Models.WorkData; |
| | | using VueWebCoreApi.Tools; |
| | | |
| | |
| | | return Json(mes); |
| | | } |
| | | #endregion |
| | | |
| | | |
| | | #region[ç产æ§è¡,æ¥å·¥è°æ´åè¡¨æ°æ®æ¥è¯¢æ¥å£] |
| | | /// <summary> |
| | | /// ç产æ§è¡,æ¥å·¥è°æ´åè¡¨æ°æ®æ¥è¯¢æ¥å£ |
| | | /// </summary> |
| | | /// <param name="wo_code">å·¥åç¼å·</param> |
| | | /// <param name="partnumber">产åç¼ç </param> |
| | | /// <param name="partname">产ååç§°</param> |
| | | /// <param name="partspec">产åè§æ ¼</param> |
| | | /// <param name="reportuser">æ¥å·¥äººå</param> |
| | | /// <param name="reportdate">æ¥å·¥æ¶é´</param> |
| | | /// <param name="page">页ç </param> |
| | | /// <param name="rows">æ¯é¡µæ¡æ°</param> |
| | | /// <param name="prop">æåºå段</param> |
| | | /// <param name="order">æåºè§å</param> |
| | | /// <returns></returns> |
| | | [Route(template: "MesOrderStepVerifySearch")] |
| | | [HttpGet] |
| | | public JsonResult MesOrderStepVerifySearch(string wo_code = null, string partnumber = null, string partname = null, string partspec = null, string reportuser = null, string reportdate = null, int page = 0, int rows = 0, string prop = null, string order = null) |
| | | { |
| | | string reportdateopendate = ""; //æ¥å·¥å¼å§æ¶é´ |
| | | string reportdateclosedate = ""; //æ¥å·¥ç»ææ¶é´ |
| | | if (reportdate != "" && reportdate != null) |
| | | { |
| | | reportdateopendate = reportdate.Split('~')[0].ToString(); |
| | | reportdateclosedate = reportdate.Split('~')[1].ToString(); |
| | | } |
| | | int startNum = rows * (page - 1) + 1; //èµ·å§è®°å½rowNum |
| | | int endNum = rows * page; //ç»æè®°å½ rowNum |
| | | mes = WorkOrderBLL.MesOrderStepVerifySearch(wo_code, partnumber, partname, partspec, reportuser, reportdateopendate, reportdateclosedate, startNum, endNum, prop, order); |
| | | return Json(mes); |
| | | } |
| | | #endregion |
| | | |
| | | #region[ç产æ§è¡,æ¥å·¥è°æ´è·åé宿¥å·¥è®°å½çä¸è¯æ°æ®] |
| | | /// <summary> |
| | | /// ç产æ§è¡,æ¥å·¥è°æ´è·åé宿¥å·¥è®°å½çä¸è¯æ°æ® |
| | | /// </summary> |
| | | /// <param name="wo_code">å·¥åå·</param> |
| | | /// <param name="step_code">å·¥åºå·</param> |
| | | /// <param name="step_type">å·¥åºç±»å(èªå¶:Z å¤å:W)</param> |
| | | /// <param name="isbott">æ¯å¦é¦éå·¥åº</param> |
| | | /// <param name="isend">æ¯å¦æ«éå·¥åº</param> |
| | | /// <param name="id">æ¥å·¥ä¸»id</param> |
| | | /// <param name="sbid">æ¥å·¥åid</param> |
| | | /// <returns></returns> |
| | | [Route(template: "MesOrderStepModelSearch")] |
| | | [HttpGet] |
| | | public JsonResult MesOrderStepModelSearch(string wo_code,string step_code,string step_type,string isbott,string isend,string id, string sbid) |
| | | { |
| | | mes = WorkOrderBLL.MesOrderStepModelSearch(wo_code, step_code, step_type, isbott, isend,id,sbid); |
| | | return Json(mes); |
| | | } |
| | | #endregion |
| | | |
| | | #region[ç产æ§è¡,æ¥å·¥è°æ´æ°æ®æäº¤] |
| | | /// <summary> |
| | | /// ç产æ§è¡,æ¥å·¥è°æ´æ°æ®æäº¤ |
| | | /// </summary> |
| | | /// <param name="json">æäº¤æ°æ®</param> |
| | | /// <returns></returns> |
| | | [Route(template: "MesOrderStepUpdateSeave")] |
| | | [HttpPost] |
| | | public JsonResult MesOrderStepUpdateSeave(List<UpdateProductReport> json) |
| | | { |
| | | var token = HttpContext.Request.Headers["Token"].ToString(); |
| | | User us = JwtTools.Denocode(token.ToString()); |
| | | mes = WorkOrderBLL.MesOrderStepUpdateSeave(us, json); |
| | | return Json(mes); |
| | | } |
| | | #endregion |
| | | } |
| | | } |
| | |
| | | } |
| | | #endregion |
| | | |
| | | #region[人ååºç¡èµæ] |
| | | public static ToMessage PersonPermissions() |
| | | { |
| | | return GeneralBasicDataDAL.PersonPermissions(); |
| | | } |
| | | #endregion |
| | | |
| | | #region[çç»æ¥æ¾äººååºç¡èµæ] |
| | | public static ToMessage GroupsPersonPermissions(string groupcode) |
| | | { |
| | | return GeneralBasicDataDAL.GroupsPersonPermissions(groupcode); |
| | | } |
| | | #endregion |
| | | |
| | | #region[æé®åºç¡èµæ] |
| | | public static ToMessage ButtonData() |
| | | { |
| | |
| | | } |
| | | #endregion |
| | | |
| | | #region[设å¤åºç¡èµæ] |
| | | public static ToMessage EqpPermissions() |
| | | { |
| | | return GeneralBasicDataDAL.EqpPermissions(); |
| | | } |
| | | #endregion |
| | | |
| | | #region[ä»åºåºç¡èµæ] |
| | | public static ToMessage WareHouse() |
| | | { |
| | |
| | | return GeneralBasicDataDAL.StepData(); |
| | | } |
| | | #endregion |
| | | |
| | | #region[缺é·åºç¡èµæ] |
| | | public static ToMessage DefectPermissions() |
| | | { |
| | | return GeneralBasicDataDAL.DefectPermissions(); |
| | | } |
| | | #endregion |
| | | |
| | | #region[徿¥åä½åºç¡èµæ] |
| | | public static ToMessage CustomerPermissions() |
| | | { |
| | | return GeneralBasicDataDAL.CustomerPermissions(); |
| | | } |
| | | #endregion |
| | | } |
| | | } |
| | |
| | | using System.Threading.Tasks; |
| | | using VueWebCoreApi.DLL.DAL; |
| | | using VueWebCoreApi.Models; |
| | | using VueWebCoreApi.Models.UpdateReport; |
| | | using VueWebCoreApi.Models.WorkData; |
| | | using VueWebCoreApi.Tools; |
| | | |
| | |
| | | return WorkOrderDAL.EditOrderNgStepSeave(json, us); |
| | | } |
| | | #endregion |
| | | |
| | | |
| | | #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) |
| | | { |
| | | return WorkOrderDAL.MesOrderStepVerifySearch(wo_code, partnumber, partname, partspec, reportuser, reportdateopendate, reportdateclosedate, startNum, endNum, prop, order); |
| | | } |
| | | #endregion |
| | | |
| | | #region[ç产æ§è¡,æ¥å·¥è°æ´è·åé宿¥å·¥è®°å½çä¸è¯æ°æ®] |
| | | public static ToMessage MesOrderStepModelSearch(string wo_code, string step_code, string step_type, string isbott, string isend, string id, string sbid) |
| | | { |
| | | return WorkOrderDAL.MesOrderStepModelSearch(wo_code, step_code, step_type, isbott, isend, id, sbid); |
| | | } |
| | | #endregion |
| | | |
| | | #region[ç产æ§è¡,æ¥å·¥è°æ´æ°æ®æäº¤] |
| | | public static ToMessage MesOrderStepUpdateSeave(User us, List<UpdateProductReport> json) |
| | | { |
| | | return WorkOrderDAL.MesOrderStepUpdateSeave(us,json); |
| | | } |
| | | #endregion |
| | | } |
| | | } |
| | |
| | | } |
| | | #endregion |
| | | |
| | | #region[人ååºç¡èµæ] |
| | | public static ToMessage PersonPermissions() |
| | | { |
| | | var sql = ""; |
| | | var dynamicParams = new DynamicParameters(); |
| | | string search = ""; |
| | | try |
| | | { |
| | | sql = @"select usercode,username from TUser where status='Y'"; |
| | | var data = DapperHelper.selectdata(sql, dynamicParams); |
| | | mes.code = "200"; |
| | | mes.Message = "æ¥è¯¢æå!"; |
| | | mes.data = data; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | mes.code = "300"; |
| | | mes.count = 0; |
| | | mes.Message = e.Message; |
| | | mes.data = null; |
| | | } |
| | | return mes; |
| | | } |
| | | #endregion |
| | | |
| | | #region[çç»æ¥æ¾äººååºç¡èµæ] |
| | | public static ToMessage GroupsPersonPermissions(string groupcode) |
| | | { |
| | | var sql = ""; |
| | | var dynamicParams = new DynamicParameters(); |
| | | try |
| | | { |
| | | sql = @"select stuff((select ',' + usercode |
| | | from (select usercode from TUser |
| | | where ',' + group_code + ',' LIKE @groupcode and status='Y') as A |
| | | FOR XML PATH(''), TYPE).value('.', 'NVARCHAR(MAX)'), 1, 1, '') AS usercode_list"; |
| | | dynamicParams.Add("@groupcode", "%," + groupcode + ",%"); |
| | | var data = DapperHelper.selectdata(sql, dynamicParams); |
| | | mes.code = "200"; |
| | | mes.Message = "æ¥è¯¢æå!"; |
| | | mes.data = data; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | mes.code = "300"; |
| | | mes.count = 0; |
| | | mes.Message = e.Message; |
| | | mes.data = null; |
| | | } |
| | | return mes; |
| | | } |
| | | #endregion |
| | | |
| | | #region[æé®åºç¡èµæ] |
| | | public static ToMessage ButtonData() |
| | | { |
| | |
| | | } |
| | | #endregion |
| | | |
| | | #region[设å¤åºç¡èµæ] |
| | | public static ToMessage EqpPermissions() |
| | | { |
| | | var sql = ""; |
| | | var dynamicParams = new DynamicParameters(); |
| | | string search = ""; |
| | | try |
| | | { |
| | | sql = @"select code,name from TEqpInfo where enable='Y'"; |
| | | var data = DapperHelper.selectdata(sql, dynamicParams); |
| | | mes.code = "200"; |
| | | mes.Message = "æ¥è¯¢æå!"; |
| | | mes.data = data; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | mes.code = "300"; |
| | | mes.count = 0; |
| | | mes.Message = e.Message; |
| | | mes.data = null; |
| | | } |
| | | return mes; |
| | | } |
| | | #endregion |
| | | |
| | | #region[ä»åºåºç¡èµæ] |
| | | public static ToMessage WareHouse() |
| | | { |
| | |
| | | } |
| | | #endregion |
| | | |
| | | #region[缺é·åºç¡èµæ] |
| | | public static ToMessage DefectPermissions() |
| | | { |
| | | var sql = ""; |
| | | var dynamicParams = new DynamicParameters(); |
| | | string search = ""; |
| | | try |
| | | { |
| | | sql = @"select code,name from TDefect"; |
| | | var data = DapperHelper.selectdata(sql, dynamicParams); |
| | | mes.code = "200"; |
| | | mes.Message = "æ¥è¯¢æå!"; |
| | | mes.data = data; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | mes.code = "300"; |
| | | mes.count = 0; |
| | | mes.Message = e.Message; |
| | | mes.data = null; |
| | | } |
| | | return mes; |
| | | } |
| | | #endregion |
| | | |
| | | #region[徿¥åä½åºç¡èµæ] |
| | | public static ToMessage CustomerPermissions() |
| | | { |
| | | var sql = ""; |
| | | var dynamicParams = new DynamicParameters(); |
| | | try |
| | | { |
| | | sql = @"select code,name from TCustomer where status='0'"; |
| | | var data = DapperHelper.selectdata(sql, dynamicParams); |
| | | mes.code = "200"; |
| | | mes.Message = "æ¥è¯¢æå!"; |
| | | mes.data = data; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | mes.code = "300"; |
| | | mes.count = 0; |
| | | mes.Message = e.Message; |
| | | mes.data = null; |
| | | } |
| | | return mes; |
| | | } |
| | | #endregion |
| | | } |
| | | } |
| | |
| | | using System.Linq; |
| | | using System.Threading.Tasks; |
| | | using VueWebCoreApi.Models; |
| | | using VueWebCoreApi.Models.UpdateReport; |
| | | using VueWebCoreApi.Models.WorkData; |
| | | using VueWebCoreApi.Tools; |
| | | |
| | |
| | | stepcode = arra[1]; //è·åæå®å符串åé¢çå符 |
| | | } |
| | | |
| | | if (ordercode != "" && stepcode == null) //å·¥åå·ä¸ä¸ºç©º,å·¥åºå·ä¸ºç©º |
| | | if (ordercode != "" && (stepcode == null || stepcode == "")) //å·¥åå·ä¸ä¸ºç©º,å·¥åºå·ä¸ºç©º |
| | | { |
| | | search += "and A.wo_code=@ordercode "; |
| | | dynamicParams.Add("@ordercode", ordercode); |
| | |
| | | dynamicParams.Add("@partspec", partspec); |
| | | } |
| | | //æ ¹æ®æ¡ä»¶æ¥è¯¢å·¥åå·¥åºä»»å¡(èªå¶å·¥åº) |
| | | sql = @"select A.status,A.wo_code,M.partcode,M.partname,M.partspec,A.seq,A.isbott,A.isend, |
| | | sql = @"select A.id,A.status,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 TStep S on A.step_code=S.stepcode |
| | | where A.status in('ALLO','START') and S.flwtype='Z' " + search; |
| | | var data = DapperHelper.GetPageList<object>(sql, dynamicParams, prop, order, startNum, endNum, out total); |
| | | if (data.ToList().Count > 0) |
| | | { |
| | | mes.code = "200"; |
| | | mes.count = total; |
| | | mes.Message = "æ¥è¯¢æå!"; |
| | | mes.data = data.ToList(); |
| | | return mes; |
| | | } |
| | | else |
| | | { |
| | | mes.code = "300"; |
| | | mes.count = 0; |
| | | mes.Message = "æ 坿§è¡çç产任å¡,ä»»å¡å·²å®ææå·²å
³é!"; |
| | | mes.data = null; |
| | | return mes; |
| | | } |
| | | mes.code = "200"; |
| | | mes.count = total; |
| | | mes.Message = "æ¥è¯¢æå!"; |
| | | mes.data = data.ToList(); |
| | | return mes; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | |
| | | stepcode = arra[1]; //è·åæå®å符串åé¢çå符 |
| | | } |
| | | |
| | | if (ordercode != "" && stepcode == null) //å·¥åå·ä¸ä¸ºç©º,å·¥åºå·ä¸ºç©º |
| | | if (ordercode != "" && (stepcode == null || stepcode == "")) //å·¥åå·ä¸ä¸ºç©º,å·¥åºå·ä¸ºç©º |
| | | { |
| | | search += "and A.wo_code=@ordercode "; |
| | | dynamicParams.Add("@ordercode", ordercode); |
| | |
| | | dynamicParams.Add("@partspec", partspec); |
| | | } |
| | | //æ ¹æ®æ¡ä»¶æ¥è¯¢å·¥åå·¥åºä»»å¡(èªå¶å·¥åº) |
| | | sql = @"select A.status,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,A.plan_startdate,A.plan_enddate,B.lm_date |
| | | sql = @"select A.id,A.status,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 |
| | | 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 |
| | | where A.status in('ALLO','START') and S.flwtype='W' " + search; |
| | | var data = DapperHelper.GetPageList<object>(sql, dynamicParams, prop, order, startNum, endNum, out total); |
| | | if (data.ToList().Count > 0) |
| | | { |
| | | mes.code = "200"; |
| | | mes.count = total; |
| | | mes.Message = "æ¥è¯¢æå!"; |
| | | mes.data = data.ToList(); |
| | | return mes; |
| | | } |
| | | else |
| | | { |
| | | mes.code = "300"; |
| | | mes.count = 0; |
| | | mes.Message = "æ 坿§è¡çç产任å¡,ä»»å¡å·²å®ææå·²å
³é!"; |
| | | mes.data = null; |
| | | return mes; |
| | | } |
| | | mes.code = "200"; |
| | | mes.count = total; |
| | | mes.Message = "æ¥è¯¢æå!"; |
| | | mes.data = data.ToList(); |
| | | return mes; |
| | | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | |
| | | stepcode = arra[1]; //è·åæå®å符串åé¢çå符 |
| | | } |
| | | |
| | | if (ordercode != "" && stepcode == null) //å·¥åå·ä¸ä¸ºç©º,å·¥åºå·ä¸ºç©º |
| | | if (ordercode != "" && (stepcode == null || stepcode == "")) //å·¥åå·ä¸ä¸ºç©º,å·¥åºå·ä¸ºç©º |
| | | { |
| | | search += "and A.wo_code=@ordercode "; |
| | | dynamicParams.Add("@ordercode", ordercode); |
| | |
| | | dynamicParams.Add("@partspec", partspec); |
| | | } |
| | | //æ ¹æ®æ¡ä»¶æ¥è¯¢å·¥åå·¥åºä»»å¡(èªå¶å·¥åº) |
| | | sql = @"select A.wo_code,M.partcode,M.partname,M.partspec,A.seq,A.isend, |
| | | sql = @"select A.id,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 TStep S on A.step_code=S.stepcode |
| | | 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); |
| | | if (data.ToList().Count > 0) |
| | | { |
| | | mes.code = "200"; |
| | | mes.count = total; |
| | | mes.Message = "æ¥è¯¢æå!"; |
| | | mes.data = data.ToList(); |
| | | return mes; |
| | | } |
| | | else |
| | | { |
| | | mes.code = "300"; |
| | | mes.count = 0; |
| | | mes.Message = "æ 坿§è¡çç产任å¡,ä»»å¡å·²å®ææå·²å
³é!"; |
| | | mes.data = null; |
| | | return mes; |
| | | } |
| | | mes.code = "200"; |
| | | mes.count = total; |
| | | mes.Message = "æ¥è¯¢æå!"; |
| | | mes.data = data.ToList(); |
| | | return mes; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | |
| | | mes = ScanStartReport.ZZEncodingSeach(wocode, stepcode); |
| | | break; |
| | | case "WX": |
| | | mes = ScanStartReport.WXEncodingSeach(SelectType, stepcode, stepcode); |
| | | mes = ScanStartReport.WXEncodingSeach(SelectType, wocode, stepcode); |
| | | break; |
| | | default: |
| | | break; |
| | |
| | | #endregion |
| | | |
| | | #region[çäº§å¼æ¥å·¥,æ¥å·¥æäº¤] |
| | | public static ToMessage SavaMesOrderStepReport(string mesordercode, string partcode, string stepseq, string stepcode,string stepprice, string eqpcode, string inbarcode, string reckway, string usergroupcode, string reportuser, string taskqty, string startqty, string reportqty, List<ReportDefectList> defectobjs, string remarks, User us) |
| | | public static ToMessage SavaMesOrderStepReport(string mesordercode, string partcode, string stepseq, string stepcode, string stepprice, string eqpcode, string inbarcode, string reckway, string usergroupcode, string reportuser, string taskqty, string startqty, string reportqty, List<ReportDefectList> defectobjs, string remarks, User us) |
| | | { |
| | | var sql = ""; |
| | | decimal ngqty = 0; |
| | | string[] arra1 = new string[] { }; |
| | | List<object> list0 = new List<object>(); |
| | | List<object> list = new List<object>(); |
| | | var dynamicParams = new DynamicParameters(); |
| | | try |
| | | { |
| | | string date = DateTime.Now.ToString(); //è·åç³»ç»æ¶é´ |
| | | //è·åæ¥å·¥äººåãåé
æ¯ä¾ |
| | | JArray arra = (JArray)Newtonsoft.Json.JsonConvert.DeserializeObject(reportuser); |
| | | //JArray arra = (JArray)Newtonsoft.Json.JsonConvert.DeserializeObject(reportuser); |
| | | //夿æ¯å¦æä¸è¯æ°æ® |
| | | 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(); // æ±æ»ä¸è¯æ°é |
| | |
| | | dynamicParams.Add("@step_code", stepcode); |
| | | dynamicParams.Add("@eqpcode", eqpcode); |
| | | var data0 = DapperHelper.selectdata(sql, dynamicParams); |
| | | if (data0.Rows.Count <= 0) |
| | | if (data0.Rows.Count <= 0) |
| | | { |
| | | //åå
¥å¼æ¥å·¥è®°å½è¡¨ |
| | | sql = @"insert into TK_Wrk_Record(wo_code,step_seq,step_code,step_price,eqp_code,materiel_code,open_person,open_time,task_qty,start_qty,style,lm_user,lm_date) |
| | | values(@mesordercode,@stepseq,@stepcode,@step_price,@eqpcode,@partcode,@username,@opentime,@taskqty,@startqty,@style,@lm_user,@lm_date)"; |
| | | list.Add(new { str = sql, parm = new { mesordercode = mesordercode, stepseq = stepseq, stepcode = stepcode, step_price=stepprice, eqpcode = eqpcode, partcode = partcode, username = us.usercode, opentime = date, taskqty = taskqty, startqty = startqty, style = "S", lm_user = us.usercode, lm_date = date } }); |
| | | list0.Add(new { str = sql, parm = new { mesordercode = mesordercode, stepseq = stepseq, stepcode = stepcode, step_price = stepprice, eqpcode = eqpcode, partcode = partcode, username = us.usercode, opentime = date, taskqty = taskqty, startqty = startqty, style = "S", lm_user = us.usercode, lm_date = date } }); |
| | | //ååå·¥åå·¥åºè¡¨ç¶æä¸ºSTART: å¼å·¥ |
| | | sql = @"update TK_Wrk_Step set status='START' where wo_code=@mesordercode and step_code=@stepcode"; |
| | | list.Add(new { str = sql, parm = new { mesordercode = mesordercode, stepcode = stepcode } }); |
| | | list0.Add(new { str = sql, parm = new { mesordercode = mesordercode, stepcode = stepcode } }); |
| | | |
| | | //ååå·¥åå·¥åºè¡¨ç¶æä¸ºå·²å¼å·¥ |
| | | sql = @"update TK_Wrk_Step set status='START' where wo_code=@mesordercode and step_code=@stepcode"; |
| | | list.Add(new { str = sql, parm = new { mesordercode = mesordercode, stepcode = stepcode } }); |
| | | //ååå·¥åè¡¨ç¶æä¸ºï¼ å¼å·¥ï¼START |
| | | sql = @"update TK_Wrk_Man set status='START' where wo_code=@mesordercode"; |
| | | list.Add(new { str = sql, parm = new { mesordercode = mesordercode } }); |
| | | list0.Add(new { str = sql, parm = new { mesordercode = mesordercode } }); |
| | | bool st = DapperHelper.DoTransaction(list0); |
| | | if (st) |
| | | { |
| | | //åå
¥æä½è®°å½è¡¨ |
| | | LogHelper.DbOperateLog(us.usercode, "å¼å·¥", "å¼å·¥äºå·¥å:" + mesordercode + "å·¥åº:" + stepcode, 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; |
| | | } |
| | | } |
| | | |
| | | //夿æ¯å¦ææ¥å·¥è®°å½(æï¼ä¿®æ¹ æ ï¼æ°å¢) |
| | |
| | | //åå
¥å¼æ¥å·¥è®°å½è¡¨ |
| | | sql = @"insert into TK_Wrk_Record(wo_code,step_seq,step_code,step_price,eqp_code,materiel_code,task_qty,start_qty,good_qty,ng_qty,style,lm_user,lm_date,inbarcode) |
| | | values(@mesordercode,@stepseq,@stepcode,@step_price,@eqpcode,@partcode,@taskqty,@startqty,@reportqty,@ngqty,@style,@lm_user,@lm_date,@inbarcode)"; |
| | | list.Add(new { str = sql, parm = new { mesordercode = mesordercode, stepseq = stepseq, stepcode = stepcode, step_price=stepprice, eqpcode = eqpcode, partcode = partcode, taskqty = taskqty, startqty = startqty, reportqty = reportqty, ngqty = ngqty, style = "B", lm_user = us.usercode, lm_date = date, inbarcode = inbarcode } }); |
| | | list.Add(new { str = sql, parm = new { mesordercode = mesordercode, stepseq = stepseq, stepcode = stepcode, step_price = stepprice, eqpcode = eqpcode, partcode = partcode, taskqty = taskqty, startqty = startqty, reportqty = reportqty, ngqty = ngqty, style = "B", lm_user = us.usercode, lm_date = date, inbarcode = inbarcode } }); |
| | | |
| | | //åå
¥å表 |
| | | for (int i = 0; i < arra.Count; i++) |
| | | { |
| | | sql = @"insert into TK_Wrk_RecordSub(m_id,eqp_code,report_person,report_date,report_qty,reckway,usergroup_code,ratio,ng_qty,style,lm_user,lm_date) |
| | | sql = @"insert into TK_Wrk_RecordSub(m_id,eqp_code,report_person,report_date,report_qty,reckway,usergroup_code,ratio,ng_qty,style,lm_user,lm_date) |
| | | values(@m_id,@eqp_code,@report_person,@report_date,@report_qty,@reckway,@usergroup_code,@ratio,@ng_qty,@style,@lm_user,@lm_date)"; |
| | | list.Add(new |
| | | list.Add(new |
| | | { |
| | | str = sql, |
| | | parm = new |
| | | { |
| | | str = sql, |
| | | parm = new |
| | | { |
| | | m_id = int.Parse(dt.Rows[0]["ID"].ToString()), |
| | | eqp_code = eqpcode, |
| | | report_person = arra[i]["usercode"].ToString(), |
| | | report_date = date, |
| | | report_qty = reportqty, |
| | | reckway = reckway, |
| | | usergroup_code = usergroupcode, |
| | | ratio = decimal.Parse(arra[i]["ratio"].ToString()), |
| | | ng_qty = ngqty, |
| | | style = "B", |
| | | lm_user = us.usercode, |
| | | lm_date = date |
| | | } |
| | | }); |
| | | |
| | | } |
| | | m_id = int.Parse(dt.Rows[0]["ID"].ToString()), |
| | | eqp_code = eqpcode, |
| | | report_person = reportuser, |
| | | report_date = date, |
| | | report_qty = reportqty, |
| | | reckway = reckway, |
| | | usergroup_code = usergroupcode, |
| | | ratio = 0, //åé
æ¯ä¾ |
| | | ng_qty = ngqty, |
| | | style = "B", |
| | | lm_user = us.usercode, |
| | | lm_date = date |
| | | } |
| | | }); |
| | | if (groupedItems.Count > 0) |
| | | { |
| | | //åå
¥ç¼ºé·è®°å½è¡¨ |
| | |
| | | //åå
¥å¼æ¥å·¥è®°å½è¡¨ |
| | | sql = @"insert into TK_Wrk_Record(wo_code,step_seq,step_code,step_price,eqp_code,materiel_code,task_qty,start_qty,good_qty,ng_qty,style,lm_user,lm_date,inbarcode) |
| | | values(@mesordercode,@stepseq,@stepcode,@step_price,@eqpcode,@partcode,@taskqty,@startqty,@reportqty,@ngqty,@style,@lm_user,@lm_date,@inbarcode)"; |
| | | list.Add(new { str = sql, parm = new { mesordercode = mesordercode, stepseq = stepseq, stepcode = stepcode, step_price=stepprice, eqpcode = eqpcode, partcode = partcode, taskqty = taskqty, startqty = startqty, reportqty = reportqty, ngqty = ngqty, style = "B", lm_user = us.usercode, lm_date = date, inbarcode = inbarcode } }); |
| | | list.Add(new { str = sql, parm = new { mesordercode = mesordercode, stepseq = stepseq, stepcode = stepcode, step_price = stepprice, eqpcode = eqpcode, partcode = partcode, taskqty = taskqty, startqty = startqty, reportqty = reportqty, ngqty = ngqty, style = "B", lm_user = us.usercode, lm_date = date, inbarcode = inbarcode } }); |
| | | |
| | | //åå
¥å表 |
| | | for (int i = 0; i < arra.Count; i++) |
| | | { |
| | | sql = @"insert into TK_Wrk_RecordSub(m_id,eqp_code,report_person,report_date,report_qty,reckway,usergroup_code,ratio,ng_qty,style,lm_user,lm_date) |
| | | sql = @"insert into TK_Wrk_RecordSub(m_id,eqp_code,report_person,report_date,report_qty,reckway,usergroup_code,ratio,ng_qty,style,lm_user,lm_date) |
| | | values(@m_id,@eqp_code,@report_person,@report_date,@report_qty,@reckway,@usergroup_code,@ratio,@ng_qty,@style,@lm_user,@lm_date)"; |
| | | list.Add(new |
| | | list.Add(new |
| | | { |
| | | str = sql, |
| | | parm = new |
| | | { |
| | | str = sql, |
| | | parm = new |
| | | { |
| | | m_id = int.Parse(dt.Rows[0]["ID"].ToString()), |
| | | eqp_code = eqpcode, |
| | | report_person = arra[i]["usercode"].ToString(), |
| | | report_date = date, |
| | | report_qty = reportqty, |
| | | reckway = reckway, |
| | | usergroup_code = usergroupcode, |
| | | ratio = decimal.Parse(arra[i]["ratio"].ToString()), |
| | | ng_qty = ngqty, |
| | | style = "B", |
| | | lm_user = us.usercode, |
| | | lm_date = date |
| | | } |
| | | }); |
| | | |
| | | } |
| | | m_id = int.Parse(dt.Rows[0]["ID"].ToString()), |
| | | eqp_code = eqpcode, |
| | | report_person = reportuser, |
| | | report_date = date, |
| | | report_qty = reportqty, |
| | | reckway = reckway, |
| | | usergroup_code = usergroupcode, |
| | | ratio = 0, //åé
æ¯ä¾ |
| | | ng_qty = ngqty, |
| | | style = "B", |
| | | lm_user = us.usercode, |
| | | lm_date = date |
| | | } |
| | | }); |
| | | if (groupedItems.Count > 0) |
| | | { |
| | | //åå
¥ç¼ºé·è®°å½è¡¨ |
| | |
| | | bool aa = DapperHelper.DoTransaction(list); |
| | | if (aa) |
| | | { |
| | | //åå
¥æä½è®°å½è¡¨ |
| | | LogHelper.DbOperateLog(us.usercode, "æ¥å·¥", "æ¥å·¥äºå·¥å:" + mesordercode + "å·¥åº:" + stepcode, us.usertype); |
| | | mes.code = "200"; |
| | | mes.count = 0; |
| | | mes.Message = "æä½æå!"; |
| | |
| | | //ä¿®æ¹åæè®°å½ |
| | | sql = @"update TK_Wrk_OutRecord set fqty=fqty+@fqty,lm_user=@username,lm_date=@CreateDate |
| | | where wo_code=@mesordercode and step_code=@stepcode and wx_code=@wx_code and style='F'"; |
| | | list.Add(new { str = sql, parm = new { mesordercode = mesordercode, stepcode = stepcode, wx_code = wxcode, fqty = decimal.Parse(fqty), username =us.usercode, CreateDate = date } }); |
| | | list.Add(new { str = sql, parm = new { mesordercode = mesordercode, stepcode = stepcode, wx_code = wxcode, fqty = decimal.Parse(fqty), username = us.usercode, CreateDate = date } }); |
| | | //åå
¥å表 |
| | | sql = @"insert into TK_Wrk_OutRecordSub(m_id,wx_code,out_person,out_time,fqty,style,lm_user,lm_date) |
| | | values(@m_id,@wx_code,@out_person,@out_time,@fqty,@style,@lm_user,@lm_date)"; |
| | |
| | | bool aa = DapperHelper.DoTransaction(list); |
| | | if (aa) |
| | | { |
| | | //åå
¥æä½è®°å½è¡¨ |
| | | LogHelper.DbOperateLog(us.usercode, "å¤ååæ", "å¤ååæå·¥å:" + mesordercode + "å·¥åº:" + stepcode, us.usertype); |
| | | mes.code = "200"; |
| | | mes.count = 0; |
| | | mes.Message = "åææå!"; |
| | |
| | | bool aa = DapperHelper.DoTransaction(list); |
| | | if (aa) |
| | | { |
| | | //åå
¥æä½è®°å½è¡¨ |
| | | LogHelper.DbOperateLog(us.usercode, "å¤åæ¶æ", "å¤åæ¶æå·¥å:" + mesordercode + "å·¥åº:" + stepcode, us.usertype); |
| | | mes.code = "200"; |
| | | mes.count = 0; |
| | | mes.Message = "æ¶æå!"; |
| | |
| | | string[] arra1 = new string[] { }; |
| | | List<object> list = new List<object>(); |
| | | var dynamicParams = new DynamicParameters(); |
| | | decimal sumrepair_qty = 0, sumlaborbad_qty = 0,summaterielbad_qty=0; //累计维修æ°éãç´¯è®¡å·¥åºæ°éã累计æåºæ°é |
| | | decimal sumrepair_qty = 0, sumlaborbad_qty = 0, summaterielbad_qty = 0; //累计维修æ°éãç´¯è®¡å·¥åºæ°éã累计æåºæ°é |
| | | try |
| | | { |
| | | string date = DateTime.Now.ToString(); //è·åç³»ç»æ¶é´ |
| | |
| | | } |
| | | }); |
| | | //åå缺é·è®°å½è¡¨çå¾
å¤çæ°é |
| | | sql = @"update CSR_WorkRecord_Defect set defect_pendqty=defect_pendqty-@repair_qty-@laborbad_qty-@materielbad_qty,laborbad_qty=laborbad_qty+@laborbad_qty,materielbad_qty=materielbad_qty+@materielbad_qty |
| | | sql = @"update CSR_WorkRecord_Defect set defect_qty=defect_qty-@repair_qty-@laborbad_qty-@materielbad_qty, defect_pendqty=defect_pendqty-@repair_qty-@laborbad_qty-@materielbad_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='B'"; |
| | | list.Add(new |
| | | { |
| | |
| | | id = int.Parse(json.Data.Rows[i]["ID"].ToString()) |
| | | } |
| | | }); |
| | | //åå
¥æ¥å·¥ç¼ºé·å¤çè®°å½è¡¨ |
| | | sql = @"insert into CSR_WorkRecord_DefectHandle(defect_id,wo_code,partnumber,step_seq,step_code,repair_qty,laborbad_qty,materielbad_qty,defect_code,style,lm_user,lm_date) |
| | | values(@defect_id,@wo_code,@partcode,@stepseq,@stepcode,@repair_qty,@laborbad_qty,@materielbad_qty,@defect_code,@style,@lm_user,@lm_date)"; |
| | | list.Add(new |
| | | //å¤æç¼ºé·è®°å½å¤ç表æ¯å¦åå¨è®°å½ |
| | | sql = @"select * from CSR_WorkRecord_DefectHandle where wo_code=@wo_code and step_code=@step_code and defect_id=@defect_id"; |
| | | dynamicParams.Add("@wo_code", json.Data.Rows[i]["WO_CODE"].ToString()); |
| | | dynamicParams.Add("@step_code", json.Data.Rows[i]["STEP_CODE"].ToString()); |
| | | dynamicParams.Add("@defect_id", json.Data.Rows[i]["ID"].ToString()); |
| | | var data = DapperHelper.selectdata(sql, dynamicParams); |
| | | if (data.Rows.Count <= 0) |
| | | { |
| | | str = sql, |
| | | parm = new |
| | | //åå
¥æ¥å·¥ç¼ºé·å¤çè®°å½è¡¨ |
| | | sql = @"insert into CSR_WorkRecord_DefectHandle(defect_id,wo_code,partnumber,step_seq,step_code,repair_qty,laborbad_qty,materielbad_qty,defect_code,style,lm_user,lm_date) |
| | | values(@defect_id,@wo_code,@partcode,@stepseq,@stepcode,@repair_qty,@laborbad_qty,@materielbad_qty,@defect_code,@style,@lm_user,@lm_date)"; |
| | | list.Add(new |
| | | { |
| | | defect_id = int.Parse(json.Data.Rows[i]["ID"].ToString()), |
| | | wo_code = json.Data.Rows[i]["WO_CODE"].ToString(), |
| | | partcode = json.Data.Rows[i]["MATERIEL_CODE"].ToString(), |
| | | stepseq = json.Data.Rows[i]["SEQ"].ToString(), |
| | | stepcode = json.Data.Rows[i]["STEP_CODE"].ToString(), |
| | | repair_qty = decimal.Parse(json.Data.Rows[i]["REPAIR_QTY"].ToString()), |
| | | laborbad_qty = decimal.Parse(json.Data.Rows[i]["LABORBAD_QTY"].ToString()), |
| | | materielbad_qty = decimal.Parse(json.Data.Rows[i]["MATERIELBAD_QTY"].ToString()), |
| | | defect_code = json.Data.Rows[i]["DEFECT_CODE"].ToString(), |
| | | style = "B", |
| | | lm_user = us.usercode, |
| | | lm_date = date |
| | | } |
| | | }); |
| | | str = sql, |
| | | parm = new |
| | | { |
| | | defect_id = int.Parse(json.Data.Rows[i]["ID"].ToString()), |
| | | wo_code = json.Data.Rows[i]["WO_CODE"].ToString(), |
| | | partcode = json.Data.Rows[i]["MATERIEL_CODE"].ToString(), |
| | | stepseq = json.Data.Rows[i]["SEQ"].ToString(), |
| | | stepcode = json.Data.Rows[i]["STEP_CODE"].ToString(), |
| | | repair_qty = decimal.Parse(json.Data.Rows[i]["REPAIR_QTY"].ToString()), |
| | | laborbad_qty = decimal.Parse(json.Data.Rows[i]["LABORBAD_QTY"].ToString()), |
| | | materielbad_qty = decimal.Parse(json.Data.Rows[i]["MATERIELBAD_QTY"].ToString()), |
| | | defect_code = json.Data.Rows[i]["DEFECT_CODE"].ToString(), |
| | | style = "B", |
| | | lm_user = us.usercode, |
| | | lm_date = date |
| | | } |
| | | }); |
| | | } |
| | | else |
| | | { |
| | | //æ´æ°æ¥å·¥ç¼ºé·å¤çè®°å½è¡¨ |
| | | sql = @"update CSR_WorkRecord_DefectHandle set repair_qty=repair_qty+@repair_qty,laborbad_qty=laborbad_qty+@laborbad_qty,materielbad_qty=materielbad_qty+@materielbad_qty |
| | | where wo_code=@wo_code and step_code=@step_code and defect_id=@defect_id"; |
| | | list.Add(new |
| | | { |
| | | str = sql, |
| | | parm = new |
| | | { |
| | | defect_id = int.Parse(json.Data.Rows[i]["ID"].ToString()), |
| | | wo_code = json.Data.Rows[i]["WO_CODE"].ToString(), |
| | | step_code = json.Data.Rows[i]["STEP_CODE"].ToString(), |
| | | repair_qty = decimal.Parse(json.Data.Rows[i]["REPAIR_QTY"].ToString()), |
| | | laborbad_qty = decimal.Parse(json.Data.Rows[i]["LABORBAD_QTY"].ToString()), |
| | | materielbad_qty = decimal.Parse(json.Data.Rows[i]["MATERIELBAD_QTY"].ToString()) |
| | | } |
| | | }); |
| | | } |
| | | |
| | | sumrepair_qty = sumrepair_qty + decimal.Parse(json.Data.Rows[i]["REPAIR_QTY"].ToString()); |
| | | sumlaborbad_qty = sumlaborbad_qty + decimal.Parse(json.Data.Rows[i]["LABORBAD_QTY"].ToString()); |
| | |
| | | } |
| | | }); |
| | | //åå缺é·è®°å½è¡¨çå¾
å¤çæ°é |
| | | sql = @"update CSR_WorkRecord_Defect set defect_pendqty=defect_pendqty-@repair_qty-@laborbad_qty-@materielbad_qty,laborbad_qty=laborbad_qty+@laborbad_qty,materielbad_qty=materielbad_qty+@materielbad_qty |
| | | sql = @"update CSR_WorkRecord_Defect set defect_qty=defect_qty-@repair_qty-@laborbad_qty-@materielbad_qty,defect_pendqty=defect_pendqty-@repair_qty-@laborbad_qty-@materielbad_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'"; |
| | | list.Add(new |
| | | { |
| | |
| | | id = int.Parse(json.Data.Rows[i]["ID"].ToString()) |
| | | } |
| | | }); |
| | | //åå
¥æ¥å·¥ç¼ºé·å¤çè®°å½è¡¨ |
| | | sql = @"insert into CSR_WorkRecord_DefectHandle(defect_id,wo_code,partnumber,step_seq,step_code,repair_qty,laborbad_qty,materielbad_qty,defect_code,style,lm_user,lm_date) |
| | | values(@defect_id,@wo_code,@partcode,@stepseq,@stepcode,@repair_qty,@laborbad_qty,@materielbad_qty,@defect_code,@style,@lm_user,@lm_date)"; |
| | | list.Add(new |
| | | //å¤æç¼ºé·è®°å½å¤ç表æ¯å¦åå¨è®°å½ |
| | | sql = @"select * from CSR_WorkRecord_DefectHandle where wo_code=@wo_code and step_code=@step_code and defect_id=@defect_id"; |
| | | dynamicParams.Add("@wo_code", json.Data.Rows[i]["WO_CODE"].ToString()); |
| | | dynamicParams.Add("@step_code", json.Data.Rows[i]["STEP_CODE"].ToString()); |
| | | dynamicParams.Add("@defect_id", json.Data.Rows[i]["ID"].ToString()); |
| | | var data = DapperHelper.selectdata(sql, dynamicParams); |
| | | if (data.Rows.Count <= 0) |
| | | { |
| | | str = sql, |
| | | parm = new |
| | | //åå
¥æ¥å·¥ç¼ºé·å¤çè®°å½è¡¨ |
| | | sql = @"insert into CSR_WorkRecord_DefectHandle(defect_id,wo_code,partnumber,step_seq,step_code,repair_qty,laborbad_qty,materielbad_qty,defect_code,style,lm_user,lm_date) |
| | | values(@defect_id,@wo_code,@partcode,@stepseq,@stepcode,@repair_qty,@laborbad_qty,@materielbad_qty,@defect_code,@style,@lm_user,@lm_date)"; |
| | | list.Add(new |
| | | { |
| | | defect_id = int.Parse(json.Data.Rows[i]["ID"].ToString()), |
| | | wo_code = json.Data.Rows[i]["WO_CODE"].ToString(), |
| | | partcode = json.Data.Rows[i]["MATERIEL_CODE"].ToString(), |
| | | stepseq = json.Data.Rows[i]["SEQ"].ToString(), |
| | | stepcode = json.Data.Rows[i]["STEP_CODE"].ToString(), |
| | | repair_qty = decimal.Parse(json.Data.Rows[i]["REPAIR_QTY"].ToString()), |
| | | laborbad_qty = decimal.Parse(json.Data.Rows[i]["LABORBAD_QTY"].ToString()), |
| | | materielbad_qty = decimal.Parse(json.Data.Rows[i]["MATERIELBAD_QTY"].ToString()), |
| | | defect_code = json.Data.Rows[i]["DEFECT_CODE"].ToString(), |
| | | style = "S", |
| | | lm_user = us.usercode, |
| | | lm_date = date |
| | | } |
| | | }); |
| | | str = sql, |
| | | parm = new |
| | | { |
| | | defect_id = int.Parse(json.Data.Rows[i]["ID"].ToString()), |
| | | wo_code = json.Data.Rows[i]["WO_CODE"].ToString(), |
| | | partcode = json.Data.Rows[i]["MATERIEL_CODE"].ToString(), |
| | | stepseq = json.Data.Rows[i]["SEQ"].ToString(), |
| | | stepcode = json.Data.Rows[i]["STEP_CODE"].ToString(), |
| | | repair_qty = decimal.Parse(json.Data.Rows[i]["REPAIR_QTY"].ToString()), |
| | | laborbad_qty = decimal.Parse(json.Data.Rows[i]["LABORBAD_QTY"].ToString()), |
| | | materielbad_qty = decimal.Parse(json.Data.Rows[i]["MATERIELBAD_QTY"].ToString()), |
| | | defect_code = json.Data.Rows[i]["DEFECT_CODE"].ToString(), |
| | | style = "S", |
| | | lm_user = us.usercode, |
| | | lm_date = date |
| | | } |
| | | }); |
| | | } |
| | | else |
| | | { |
| | | //æ´æ°æ¥å·¥ç¼ºé·å¤çè®°å½è¡¨ |
| | | sql = @"update CSR_WorkRecord_DefectHandle set repair_qty=repair_qty+@repair_qty,laborbad_qty=laborbad_qty+@laborbad_qty,materielbad_qty=materielbad_qty+@materielbad_qty |
| | | where wo_code=@wo_code and step_code=@step_code and defect_id=@defect_id"; |
| | | list.Add(new |
| | | { |
| | | str = sql, |
| | | parm = new |
| | | { |
| | | defect_id = int.Parse(json.Data.Rows[i]["ID"].ToString()), |
| | | wo_code = json.Data.Rows[i]["WO_CODE"].ToString(), |
| | | step_code = json.Data.Rows[i]["STEP_CODE"].ToString(), |
| | | repair_qty = decimal.Parse(json.Data.Rows[i]["REPAIR_QTY"].ToString()), |
| | | laborbad_qty = decimal.Parse(json.Data.Rows[i]["LABORBAD_QTY"].ToString()), |
| | | materielbad_qty = decimal.Parse(json.Data.Rows[i]["MATERIELBAD_QTY"].ToString()) |
| | | } |
| | | }); |
| | | } |
| | | sumrepair_qty = sumrepair_qty + decimal.Parse(json.Data.Rows[i]["REPAIR_QTY"].ToString()); |
| | | sumlaborbad_qty = sumlaborbad_qty + decimal.Parse(json.Data.Rows[i]["LABORBAD_QTY"].ToString()); |
| | | summaterielbad_qty = summaterielbad_qty + decimal.Parse(json.Data.Rows[i]["MATERIELBAD_QTY"].ToString()); |
| | |
| | | stepcode = json.Data.Rows[0]["STEP_CODE"].ToString(), |
| | | sumrepair_qty = sumrepair_qty, |
| | | sumlaborbad_qty = sumlaborbad_qty, |
| | | summaterielbad_qty= summaterielbad_qty |
| | | summaterielbad_qty = summaterielbad_qty |
| | | } |
| | | }); |
| | | bool aa = DapperHelper.DoTransaction(list); |
| | | if (aa) |
| | | { |
| | | //åå
¥æä½è®°å½è¡¨ |
| | | 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 = "æä½æå!"; |
| | |
| | | return mes; |
| | | } |
| | | #endregion |
| | | |
| | | |
| | | |
| | | #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) |
| | | { |
| | | var dynamicParams = new DynamicParameters(); |
| | | string search = ""; |
| | | try |
| | | { |
| | | 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 (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 |
| | | 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, |
| | | 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; |
| | | 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 MesOrderStepModelSearch(string wo_code, string step_code, string step_type, string isbott, string isend, string id, string sbid) |
| | | { |
| | | var sql = ""; |
| | | List<object> list = new List<object>(); |
| | | var dynamicParams = new DynamicParameters(); |
| | | try |
| | | { |
| | | if (step_type == "Z") |
| | | { |
| | | sql = @"select D.id,D.record_id,D.defect_code, |
| | | STUFF((SELECT ',' + F.name |
| | | FROM TDefect F |
| | | WHERE CHARINDEX(',' + F.code + ',', ',' + D.defect_code + ',') > 0 |
| | | FOR XML PATH('')), 1, 1, '') AS defect_name, |
| | | D.defect_qty,laborbad_qty,materielbad_qty |
| | | from CSR_WorkRecord_Defect D |
| | | where wo_code=@wo_code and step_code=@step_code and record_id=@id"; |
| | | dynamicParams.Add("@wo_code", wo_code); |
| | | dynamicParams.Add("@step_code", step_code); |
| | | dynamicParams.Add("@id", id); |
| | | var data = DapperHelper.selectdata(sql, dynamicParams); |
| | | mes.code = "200"; |
| | | mes.count = 0; |
| | | mes.Message = "æ¥è¯¢æå!"; |
| | | mes.data = data; |
| | | |
| | | } |
| | | if (step_type == "W") |
| | | { |
| | | sql = @"select D.id,D.record_id,D.defect_code, |
| | | STUFF((SELECT ',' + F.name |
| | | FROM TDefect F |
| | | WHERE CHARINDEX(',' + F.code + ',', ',' + D.defect_code + ',') > 0 |
| | | FOR XML PATH('')), 1, 1, '') AS defect_name, |
| | | D.defect_qty,laborbad_qty,materielbad_qty |
| | | from CSR_WorkRecord_Defect D |
| | | where wo_code=@wo_code and step_code=@step_code and record_id=@id"; |
| | | dynamicParams.Add("@wo_code", wo_code); |
| | | dynamicParams.Add("@step_code", step_code); |
| | | dynamicParams.Add("@id", id); |
| | | var data = DapperHelper.selectdata(sql, dynamicParams); |
| | | mes.code = "200"; |
| | | mes.count = 0; |
| | | mes.Message = "æ¥è¯¢æå!"; |
| | | mes.data = data; |
| | | } |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | mes.code = "300"; |
| | | mes.count = 0; |
| | | mes.Message = e.Message; |
| | | mes.data = null; |
| | | } |
| | | return mes; |
| | | } |
| | | #endregion |
| | | |
| | | #region[ç产æ§è¡,æ¥å·¥è°æ´æ°æ®æäº¤] |
| | | public static ToMessage MesOrderStepUpdateSeave(User us, List<UpdateProductReport> json) |
| | | { |
| | | var sql = ""; |
| | | List<object> list = new List<object>(); |
| | | var dynamicParams = new DynamicParameters(); |
| | | try |
| | | { |
| | | string date = DateTime.Now.ToString(); //è·åç³»ç»æ¶é´ |
| | | list.Clear(); |
| | | //夿å½åå·¥åºæ¯èªå¶å·¥åºè¿æ¯å¤åå·¥åº |
| | | if (json[0].flw_type.ToString() == "Z")//èªå¶å·¥åº |
| | | { |
| | | //è·åæ¤æ¬¡æ¥å·¥è°æ´æäº¤çæ°æ®(åæ ¼æ°éãä¸è¯æ°éãå·¥åºæ°éãæåºæ°é) |
| | | 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));//æåºæ°é差弿±æ» |
| | | //é¦éå·¥åºçæ¥å·¥ |
| | | if (json[0].first_choke == "Y") |
| | | { |
| | | //æ¥è¯¢å½åé¦éæ¥å·¥å·¥åºéæ¤æ¬¡æ¥å·¥ï¼æ»æ¥å·¥æ°éãæ»ä¸è¯æ°éãæ»å·¥åºæ°éãæ»æåºæ°é |
| | | 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); |
| | | 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_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())) |
| | | { |
| | | mes.code = "300"; |
| | | mes.count = 0; |
| | | 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) |
| | | { |
| | | //夿å½åå·¥åºï¼æ¥å·¥æ»æ°æ°é+ä¸è¯æ»æ°æ°é+å·¥åºæ»æ°é+æåºæ»æ°é<ä¸éå·¥åºæ¥å·¥æ»æ°é+ä¸éå·¥åºä¸è¯æ»æ°é+ä¸éå·¥åºå·¥åºæ»æ°é+ä¸éå·¥åºæåºæ»æ°é |
| | | 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)) |
| | | { |
| | | mes.code = "300"; |
| | | mes.count = 0; |
| | | mes.Message = "èªå¶é¦éå·¥åºä¿®æ¹æ¥å·¥æ»åæ ¼æ°éï¼ã" + (notthis_reportqty + decimal.Parse(json[0].report_qty)) + "ãä¸è½å°äºä¸éå·¥åºæ¥å·¥æ»æ°éï¼ã" + last_updatereportsumqty + "ã,请è¾å
¥åæ³æ°å¼æå
ä¿®æ¹ä¸éå·¥åºæ¥å·¥æ°é!"; |
| | | mes.data = null; |
| | | return mes; |
| | | } |
| | | } |
| | | } |
| | | //æ«éå·¥åºçæ¥å·¥ |
| | | else if (json[0].last_choke == "Y") |
| | | { |
| | | //æ¥è¯¢å½åæ«éæ¥å·¥å·¥åºéæ¤æ¬¡æ¥å·¥ï¼æ»æ¥å·¥æ°éãæ»ä¸è¯æ°éãæ»å·¥åºæ°éãæ»æåºæ°é |
| | | 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); |
| | | 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_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(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(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); |
| | | 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_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(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; |
| | | } |
| | | } |
| | | //æ¥è¯¢å½åå·¥åºä¸éå·¥åºï¼æ»æ¥å·¥æ°éãæ»ä¸è¯æ°éãæ»æ¥åºæ°é |
| | | 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 + decimal.Parse(json[0].report_qty)< last_updatereportsumqty)) |
| | | { |
| | | mes.code = "300"; |
| | | mes.count = 0; |
| | | mes.Message = "èªå¶å·¥åºä¿®æ¹æ¥å·¥æ»åæ ¼æ°éï¼ã" + (notthis_reportqty + decimal.Parse(json[0].report_qty)) + "ãä¸è½å°äºä¸éå·¥åºæ¥å·¥æ»æ°éï¼ã" + last_updatereportsumqty + "ã,请è¾å
¥åæ³æ°å¼æå
ä¿®æ¹ä¸éå·¥åºæ¥å·¥æ°é!"; |
| | | mes.data = null; |
| | | return mes; |
| | | } |
| | | } |
| | | } |
| | | |
| | | ///////////////////////////////ä¿®æ¹æ¥å·¥////////////////////////////// |
| | | |
| | | //åå对åºçæ¥å·¥è®°å½åè¡¨åæ ¼æ°éãä¸è¯æ°éãæ¥åºæ°é |
| | | sql = @"update TK_Wrk_RecordSub set report_qty=report_qty+@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='B'"; |
| | | list.Add(new |
| | | { |
| | | str = sql, |
| | | parm = new |
| | | { |
| | | m_id = int.Parse(json[0].id), |
| | | id = int.Parse(json[0].sbid), |
| | | repair_qty = decimal.Parse(json[0].report_dvalue), |
| | | ng_qty = this_ng_dvalue, |
| | | laborbad_qty = this_laborbad_dvalue, |
| | | materielbad_qty = this_materielbad_dvalue, |
| | | //bad_money = decimal.Parse(json[i].badmoney_dvalue), |
| | | updatereportuser = us.usercode, |
| | | updatereportdate = date |
| | | } |
| | | }); |
| | | //åå对åºçæ¥å·¥è®°å½ä¸»è¡¨åæ ¼æ°éãä¸è¯æ°éãæ¥åºæ°é |
| | | 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 |
| | | where wo_code=@wo_code and step_code=@step_code and id=@id and style='B'"; |
| | | list.Add(new |
| | | { |
| | | str = sql, |
| | | parm = new |
| | | { |
| | | good_qty = decimal.Parse(json[0].report_dvalue), |
| | | ng_qty = this_ng_dvalue, |
| | | laborbad_qty = this_laborbad_dvalue, |
| | | materielbad_qty = this_materielbad_dvalue, |
| | | wo_code = json[0].wo_code, |
| | | step_code = json[0].step_code, |
| | | id = int.Parse(json[0].id) |
| | | } |
| | | }); |
| | | //ååå·¥åå·¥åºè¡¨ |
| | | sql = @"update TK_Wrk_Step set good_qty=good_qty+@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"; |
| | | list.Add(new |
| | | { |
| | | str = sql, |
| | | parm = new |
| | | { |
| | | good_qty = decimal.Parse(json[0].report_dvalue), |
| | | ng_qty = this_ng_dvalue, |
| | | laborbad_qty = this_laborbad_dvalue, |
| | | materielbad_qty = this_materielbad_dvalue, |
| | | wo_code = json[0].wo_code, |
| | | step_code = json[0].step_code |
| | | } |
| | | }); |
| | | |
| | | for (int i = 0; i < json[0].children.Count; i++) |
| | | { |
| | | //ååä¸è¯ |
| | | sql = @"update CSR_WorkRecord_Defect set defect_qty=defect_qty+@ng_qty,defect_pendqty=defect_pendqty+@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=@ng_id and record_id=@record_id and style='B'"; |
| | | list.Add(new |
| | | { |
| | | str = sql, |
| | | parm = new |
| | | { |
| | | ng_qty = decimal.Parse(json[0].children[i].ng_dvalue), |
| | | laborbad_qty = decimal.Parse(json[0].children[i].laborbad_dvalue), |
| | | materielbad_qty = decimal.Parse(json[0].children[i].materielbad_dvalue), |
| | | wo_code = json[0].wo_code, |
| | | step_code = json[0].step_code, |
| | | ng_id = int.Parse(json[0].children[i].ng_id), |
| | | record_id = json[0].id, |
| | | updatereportuser = us.usercode, |
| | | updatereportdate = date |
| | | } |
| | | }); |
| | | //ååä¸è¯å¤ç |
| | | sql = @"update CSR_WorkRecord_DefectHandle set laborbad_qty=laborbad_qty+@laborbad_qty,materielbad_qty=materielbad_qty+@materielbad_qty |
| | | where wo_code=@wo_code and step_code=@step_code and defect_id=@defect_id and style='B'"; |
| | | list.Add(new |
| | | { |
| | | str = sql, |
| | | parm = new |
| | | { |
| | | laborbad_qty = decimal.Parse(json[0].children[i].laborbad_dvalue), |
| | | materielbad_qty = decimal.Parse(json[0].children[i].materielbad_dvalue), |
| | | wo_code = json[0].wo_code, |
| | | step_code = json[0].step_code, |
| | | defect_id = int.Parse(json[0].children[i].ng_id), |
| | | updatereportuser = us.usercode, |
| | | updatereportdate = date |
| | | } |
| | | }); |
| | | } |
| | | } |
| | | if (json[0].flw_type.ToString() == "W")//å¤åå·¥åº |
| | | { |
| | | |
| | | } |
| | | |
| | | bool aa = DapperHelper.DoTransaction(list); |
| | | if (aa) |
| | | { |
| | | 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; |
| | | } |
| | | #endregion |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Threading.Tasks; |
| | | |
| | | namespace VueWebCoreApi.Models.UpdateReport |
| | | { |
| | | /// <summary> |
| | | /// ä¿®æ¹æ¥å·¥æäº¤æ°æ®ç±» |
| | | /// </summary> |
| | | public class UpdateProductReport |
| | | { |
| | | public string id { get; set; } //æ¥å·¥è®°å½ä¸»è¡¨id/å¤åæ¶æè®°å½ä¸»è¡¨id |
| | | public string sbid { get; set; } //æ¥å·¥è®°å½å表id/å¤åæ¶æè®°å½å表id |
| | | public string wo_code { get; set; } //ç产工åå· |
| | | public string partnumber { get; set; } //ç©æç¼ç |
| | | public string task_qty { get; set; } //工忰é |
| | | public string wkshp_code { get; set; } //车é´ç¼å· |
| | | public string eqp_code { get; set; } //设å¤ç¼ç /å¤åä¾åºåç¼ç |
| | | public string step_seq { get; set; } //å·¥åºåºå· |
| | | public string step_code { get; set; } //å·¥åºç¼ç |
| | | public string flw_type { get; set; } //å·¥åºå±æ§(Z:èªå¶ W:å¤å) |
| | | public string first_choke { get; set; } //æ¯å¦é¦éå·¥åº |
| | | public string last_choke { get; set; } //æ¯å¦æ«éå·¥åº |
| | | public string unprice { get; set; } //å·¥åºåä»· |
| | | public string groupcode { get; set; } //çç»ç¼ç |
| | | public string usercode { get; set; } //æ¥å·¥äººåç¼ç |
| | | public string report_date { get; set; } //æ¥å·¥æ¶é´ |
| | | public string report_qty { get; set; } //æ¥å·¥æ°é |
| | | public string report_dvalue { get; set; } //æ¥å·¥æ°éå·®å¼ |
| | | public List<UpdateReportSub> children { get; set; } |
| | | } |
| | | public class UpdateReportSub |
| | | { |
| | | public string ng_id { get; set; } //ä¸è¯è®°å½ä¸»id |
| | | public string ng_sbid { get; set; } //ä¸è¯è®°å½åid |
| | | public string ng_qty { get; set; } //ä¸è¯æ°é |
| | | public string ng_dvalue { get; set; } //ä¸è¯æ°éå·®å¼ |
| | | public string laborbad_qty { get; set; } //å·¥åºæ°é |
| | | public string laborbad_dvalue { get; set; } //å·¥åºæ°éå·®å¼ |
| | | public string materielbad_qty { get; set; } //æåºæ°é |
| | | public string materielbad_dvalue { get; set; } //æåºæ°éå·®å¼ |
| | | public string bad_money { get; set; } //æ¥åºéé¢ |
| | | public string badmoney_dvalue { get; set; } //æ¥åºéé¢å·®å¼ |
| | | } |
| | | } |
| | |
| | | { |
| | | string sql, year = "", month = "", day = "", fdate = "", q = "", cunm2 = "", Encode = "", cunm = ""; |
| | | int digit2 = 0, value2 = 0, digit3 = 0, digitdiff = 0; |
| | | decimal labcum = 0; |
| | | bool stf; |
| | | List<object> list = new List<object>(); |
| | | List<string> listdt = new List<string>(); |
| | | List<AppLabCode> lab = new List<AppLabCode>(); |
| | | var dynamicParams = new DynamicParameters(); |
| | | //è·åæ ç¾ä¸ªæ°:è¿ä¸æ³ |
| | | decimal labcum = Math.Ceiling(decimal.Parse(qty) / decimal.Parse(onelabqty)); |
| | | if (qty == "0" && onelabqty == "0") |
| | | { |
| | | labcum = 1; |
| | | } |
| | | else |
| | | { |
| | | labcum = Math.Ceiling(decimal.Parse(qty) / decimal.Parse(onelabqty)); |
| | | } |
| | | try |
| | | { |
| | | sql = @"select prefix,filingdate,incbit,value from TCodeRules where rightcode=@rightcode"; |
| | | dynamicParams.Add("@rightcode", rightcode); |
| | | sql = @"select prefix,filingdate,incbit,value from TCodeRules where menucode=@menucode"; |
| | | dynamicParams.Add("@menucode", rightcode); |
| | | var data = DapperHelper.selectdata(sql, dynamicParams); |
| | | if (data.Rows.Count > 0) |
| | | { |
| | |
| | | break; |
| | | } |
| | | //æ´æ°è§åè¡¨ä½æ°åæµæ°´å· |
| | | sql = @"update TCodeRules set incbit=@incbit,value=@cunm2 where rightcode=@rightcode"; |
| | | sql = @"update TCodeRules set incbit=@incbit,value=@cunm2 where menucode=@menucode"; |
| | | dynamicParams.Add("@incbit", cunm.Length); |
| | | dynamicParams.Add("@cunm2", cunm); |
| | | dynamicParams.Add("@rightcode", rightcode); |
| | | dynamicParams.Add("@menucode", rightcode); |
| | | list.Add(new { str = sql, parm = dynamicParams }); |
| | | stf = DapperHelper.DoTransaction(list); |
| | | if (stf) |
| | |
| | | } |
| | | |
| | | //1.æ ¹æ®å·¥å+å·¥åºæ¥æ¾å½åå·¥åºæ¯å¦é¦éå·¥åº |
| | | sql = @"select A.wo_code,P.partcode,P.partname,P.partspec, T.stepcode,T.stepname,A.stepprice,A.seq,T.flwtype,T.descr,A.status,A.plan_qty,A.isbott,A.isend,L.org_code,L.org_name |
| | | sql = @"select A.wo_code,P.partcode,P.partname,P.partspec, T.stepcode,T.stepname,A.stepprice,A.seq,T.flwtype,T.descr,A.status,A.plan_qty,A.isbott,A.isend,L.torg_code,L.torg_name |
| | | from TK_Wrk_Step A |
| | | left join TStep T on A.step_code=T.stepcode |
| | | left join TK_Wrk_Man M on A.wo_code=M.wo_code |
| | | left join TMateriel_Info P on M.materiel_code=P.partcode |
| | | left join TOrganization L on M.wkshp_code=L.org_code |
| | | left join TOrganization L on M.wkshp_code=L.torg_code |
| | | where A.wo_code=@ordercode and A.step_code=@stepcode"; |
| | | dynamicParams.Add("@ordercode", ordercode); |
| | | dynamicParams.Add("@stepcode", stepcode); |
| | | var data = DapperHelper.selectdata(sql, dynamicParams); |
| | | if (data.Rows.Count > 0) |
| | | { |
| | | rt.wkshopcode = data.Rows[0]["org_code"].ToString(); //车é´ç¼ç |
| | | rt.wkshopname = data.Rows[0]["org_name"].ToString(); //车é´åç§° |
| | | rt.wkshopcode = data.Rows[0]["torg_code"].ToString(); //车é´ç¼ç |
| | | rt.wkshopname = data.Rows[0]["torg_name"].ToString(); //车é´åç§° |
| | | rt.wo_code = data.Rows[0]["WO_CODE"].ToString(); //å·¥åå· |
| | | rt.partnumber = data.Rows[0]["PARTCODE"].ToString(); //产åç¼ç |
| | | rt.partname = data.Rows[0]["PARTNAME"].ToString(); //产ååç§° |
| | |
| | | { |
| | | rt.nextstepcode = dt.Rows[0]["STEPCODE"].ToString();//ä¸éå·¥åºç¼ç |
| | | rt.nextstepname = dt.Rows[0]["STEPNAME"].ToString();//ä¸éå·¥åºåç§° |
| | | rt.nextstepprice = data.Rows[0]["NEXTSTEPPRICE"].ToString(); //ä¸éå·¥åºå·¥ä»· |
| | | rt.nextstepprice = dt.Rows[0]["STEPPRICE"].ToString(); //ä¸éå·¥åºå·¥ä»· |
| | | } |
| | | if (isend == "Y") //å½åå·¥åºæ¯æ«éå·¥åº |
| | | { |
| | |
| | | } |
| | | |
| | | //1.æ ¹æ®å·¥å+å·¥åºæ¥æ¾å½åå·¥åºæ¯å¦é¦éå·¥åº |
| | | sql = @"select A.wo_code,P.partcode,P.partname,P.partspec, T.stepcode,T.stepname,A.seq,T.flwtype,T.descr,A.stepprice,A.status,A.plan_qty,A.isbott,A.isend,L.org_code,L.org_name |
| | | sql = @"select A.wo_code,P.partcode,P.partname,P.partspec, T.stepcode,T.stepname,A.seq,T.flwtype,T.descr,A.stepprice,A.status,A.plan_qty,A.isbott,A.isend,L.torg_code,L.torg_name |
| | | from TK_Wrk_Step A |
| | | left join TStep T on A.step_code=T.stepcode |
| | | left join TK_Wrk_Man M on A.wo_code=M.wo_code |
| | | left join TMateriel_Info P on M.materiel_code=P.partcode |
| | | left join TOrganization L on M.wkshp_code=L.org_code |
| | | left join TOrganization L on M.wkshp_code=L.torg_code |
| | | where A.wo_code=@ordercode and A.step_code=@stepcode"; |
| | | dynamicParams.Add("@ordercode", ordercode); |
| | | dynamicParams.Add("@stepcode", stepcode); |
| | | var data = DapperHelper.selectdata(sql, dynamicParams); |
| | | if (data.Rows.Count > 0) |
| | | { |
| | | rt.wkshopcode = data.Rows[0]["org_code"].ToString(); //车é´ç¼ç |
| | | rt.wkshopname = data.Rows[0]["org_name"].ToString(); //车é´åç§° |
| | | rt.wkshopcode = data.Rows[0]["torg_code"].ToString(); //车é´ç¼ç |
| | | rt.wkshopname = data.Rows[0]["torg_name"].ToString(); //车é´åç§° |
| | | rt.wo_code = data.Rows[0]["WO_CODE"].ToString(); //å·¥åå· |
| | | rt.partnumber = data.Rows[0]["PARTCODE"].ToString(); //产åç¼ç |
| | | rt.partname = data.Rows[0]["PARTNAME"].ToString(); //产ååç§° |
| | |
| | | { |
| | | rt.nextstepcode = dt.Rows[0]["STEPCODE"].ToString();//ä¸éå·¥åºç¼ç |
| | | rt.nextstepname = dt.Rows[0]["STEPNAME"].ToString();//ä¸éå·¥åºåç§° |
| | | rt.nextstepprice = data.Rows[0]["NEXTSTEPPRICE"].ToString(); //ä¸éå·¥åºå·¥ä»· |
| | | rt.nextstepprice = dt.Rows[0]["STEPPRICE"].ToString(); //ä¸éå·¥åºå·¥ä»· |
| | | } |
| | | if (isend == "Y") //å½åå·¥åºæ¯æ«éå·¥åº |
| | | { |
| | |
| | | { |
| | | //1.é¦éå·¥åºæ¶ï¼å¤ææ¯å¦æåæè®°å½ |
| | | sql = @"select R.wo_code,R.step_code,R.wx_code as code,C.name,R.materiel_code, |
| | | isnull(sum(R.fqty),0) as fqty,isnull(sum(R.sqty),0) as sqty,isnull(sum(R.ng_qty),0) as ng_qty,isnull(sum(R.bad_qty),0) as bad_qty |
| | | isnull(sum(R.fqty),0) as fqty,isnull(sum(R.sqty),0) as sqty,isnull(sum(R.ng_qty),0) as ng_qty,isnull(sum(R.laborbad_qty),0) as laborbad_qty,isnull(sum(R.materielbad_qty),0) as materielbad_qty |
| | | from TK_Wrk_OutRecord R |
| | | left join TCustomer C on R.wx_code=C.code |
| | | where R.wo_code=@ordercode and R.step_code=@stepcode and R.style='F' |
| | |
| | | { |
| | | //1.é¦éå·¥åºæ¶ï¼å¤ææ¯å¦ææ¶æè®°å½ |
| | | sql = @"select R.wo_code,R.step_code,R.wx_code as code,C.name,R.materiel_code, |
| | | isnull(sum(R.fqty),0) as fqty,isnull(sum(R.sqty),0) as sqty,isnull(sum(R.ng_qty),0) as ng_qty,isnull(sum(R.bad_qty),0) as bad_qty |
| | | isnull(sum(R.fqty),0) as fqty,isnull(sum(R.sqty),0) as sqty,isnull(sum(R.ng_qty),0) as ng_qty,isnull(sum(R.laborbad_qty),0) as laborbad_qty,isnull(sum(R.materielbad_qty),0) as materielbad_qty |
| | | from TK_Wrk_OutRecord R |
| | | left join TCustomer C on R.wx_code=C.code |
| | | where R.wo_code=@ordercode and R.step_code=@stepcode and R.style='S' |
| | |
| | | fqty = g.Sum(i => (decimal)i["fqty"]), |
| | | sqty = g.Sum(i => (decimal)i["sqty"]), |
| | | ng_qty = g.Sum(i => (decimal)i["ng_qty"]), |
| | | bad_qty = g.Sum(i => (decimal)i["bad_qty"]) |
| | | laborbad_qty = g.Sum(i => (decimal)i["laborbad_qty"]), |
| | | materielbad_qty = g.Sum(i => (decimal)i["materielbad_qty"]) |
| | | }).ToList(); |
| | | |
| | | mes.code = "200"; |
| | |
| | | fqty = g.Sum(i => (decimal)i["fqty"]), |
| | | sqty = g.Sum(i => (decimal)i["sqty"]), |
| | | ng_qty = g.Sum(i => (decimal)i["ng_qty"]), |
| | | bad_qty = g.Sum(i => (decimal)i["bad_qty"]) |
| | | laborbad_qty = g.Sum(i => (decimal)i["laborbad_qty"]), |
| | | materielbad_qty = g.Sum(i => (decimal)i["materielbad_qty"]) |
| | | }).ToList(); |
| | | |
| | | mes.code = "200"; |
| | |
| | | { |
| | | //1.éé¦éå·¥åºæ¶ï¼å¤ææ¬éæ¯å¦æåæè®°å½ |
| | | sql = @"select R.wo_code,R.step_code,R.wx_code as code,C.name,R.materiel_code, |
| | | isnull(sum(R.fqty),0) as fqty,isnull(sum(R.sqty),0) as sqty,isnull(sum(R.ng_qty),0) as ng_qty,isnull(sum(R.bad_qty),0) as bad_qty |
| | | isnull(sum(R.fqty),0) as fqty,isnull(sum(R.sqty),0) as sqty,isnull(sum(R.ng_qty),0) as ng_qty,isnull(sum(R.laborbad_qty),0) as laborbad_qty,isnull(sum(R.materielbad_qty),0) as materielbad_qty |
| | | from TK_Wrk_OutRecord R |
| | | left join TCustomer C on R.wx_code=C.code |
| | | where R.wo_code=@ordercode and R.step_code=@stepcode and R.style='F' |
| | |
| | | { |
| | | //2.éé¦éå·¥åºæ¶ï¼å¤ææ¬éæ¯å¦ææ¶æè®°å½ |
| | | sql = @"select R.wo_code,R.step_code,R.wx_code as code,C.name,R.materiel_code, |
| | | isnull(sum(R.fqty),0) as fqty,isnull(sum(R.sqty),0) as sqty,isnull(sum(R.ng_qty),0) as ng_qty,isnull(sum(R.bad_qty),0) as bad_qty |
| | | isnull(sum(R.fqty),0) as fqty,isnull(sum(R.sqty),0) as sqty,isnull(sum(R.ng_qty),0) as ng_qty,isnull(sum(R.laborbad_qty),0) as laborbad_qty,isnull(sum(R.materielbad_qty),0) as materielbad_qty |
| | | from TK_Wrk_OutRecord R |
| | | left join TCustomer C on R.wx_code=C.code |
| | | where R.wo_code=@ordercode and R.step_code=@stepcode and R.style='S' |
| | |
| | | fqty = g.Sum(i => (decimal)i["fqty"]), |
| | | sqty = g.Sum(i => (decimal)i["sqty"]), |
| | | ng_qty = g.Sum(i => (decimal)i["ng_qty"]), |
| | | bad_qty = g.Sum(i => (decimal)i["bad_qty"]) |
| | | laborbad_qty = g.Sum(i => (decimal)i["laborbad_qty"]), |
| | | materielbad_qty = g.Sum(i => (decimal)i["materielbad_qty"]) |
| | | }).ToList(); |
| | | |
| | | mes.code = "200"; |
| | |
| | | fqty = g.Sum(i => (decimal)i["fqty"]), |
| | | sqty = g.Sum(i => (decimal)i["sqty"]), |
| | | ng_qty = g.Sum(i => (decimal)i["ng_qty"]), |
| | | bad_qty = g.Sum(i => (decimal)i["bad_qty"]) |
| | | laborbad_qty = g.Sum(i => (decimal)i["laborbad_qty"]), |
| | | materielbad_qty = g.Sum(i => (decimal)i["materielbad_qty"]) |
| | | }).ToList(); |
| | | mes.code = "200"; |
| | | mes.count = 3; |