| | |
| | | double HmaterOutqty = list[0].HmaterOutqty;//白坯发布 |
| | | double HProcPriceRate = list[0].HProcPriceRate;//工价系数 |
| | | int HTemporaryAreaID = list[0].HTemporaryAreaID;//暂放区 |
| | | double HWasterQty_Work = list[0].HWasterQty_Work;//工废数量 |
| | | double HWasterQty_Mater = list[0].HWasterQty_Mater;//料废数量 |
| | | double HBackWorkQty = list[0].HBackWorkQty;//返工数量 |
| | | Int64 HShiftsID = list[0].HShiftsID;//生产班次 |
| | | |
| | | LogService.Write($"1.字段赋值,用时" + sw.Elapsed ); |
| | | |
| | |
| | | ",HSupID,HQty,HPrice,HMoney,HBadCount,HCenterID,HProcNo,HOrderProcNO,HSourceNameList" + |
| | | ",HMainSourceInterID,HMainSourceBillNo,HMainSourceBillType,HLastSubProc" + |
| | | ",HEmpID2,HEmpID3,HEmpID4,HEmpID5,HDSQty,HChongQty,HPriceRate,HWorkTimes,HQCCheckID,HMainInterID,HPRDOrgID" + |
| | | ",HmaterOutqty,HProcPriceRate,HTemporaryAreaID" + |
| | | ",HmaterOutqty,HProcPriceRate,HTemporaryAreaID,HWasterQty_Work,HWasterQty_Mater,HBackWorkQty,HShiftsID" + |
| | | ") " + |
| | | " values('" + BillType + "','" + (OperationType == "5" ? "SUB" : HBillSubType) + "'," + HInterID + ",'" + HBillNo + "'," + HBillStatus + ",getdate(),'" + HMaker + "',getdate(),'" + HMouldNum + "'" + |
| | | "," + HYear + "," + HPeriod + ",'" + HRemark + "','" + HSourceName + "'," + HPieceQty + "," + HWasterQty + "," + HPlanPieceQty + "," + HBadPNL + |
| | |
| | | "," + HSupID + "," + HQty + "," + HPrice + "," + HMoney + "," + HBadCount + "," + HCenterID + "," + HProcNo + ",'" + HOrderProcNO + "'" + ",'" + HSourceNameList + "'" + |
| | | "," + HMainSourceInterID + ",'" + HMainSourceBillNo + "','" + HMainSourceBillType + "'," + Convert.ToString(HLastSubProc ? 1 : 0) + |
| | | "," + HEmpID2 + "," + HEmpID3 + "," + HEmpID4 + "," + HEmpID5 + "," + HDSQty + "," + HChongQty + "," + HPriceRate + "," + HWorkTimes + "," + HQCCheckID + "," + HMainInterID + "," + HPRDOrgID + |
| | | ","+ HmaterOutqty + "," + HProcPriceRate + ","+ HTemporaryAreaID + ") "); |
| | | ","+ HmaterOutqty + "," + HProcPriceRate + ","+ HTemporaryAreaID + "," + HWasterQty_Work + "," + HWasterQty_Mater + "," + HBackWorkQty + |
| | | "," + HShiftsID + ") "); |
| | | |
| | | LogService.Write($"4.新增结束,用时" + sw.Elapsed); |
| | | LogService.Write("用户:" + user + ",日期:" + DateTime.Now + ",新增工序出站单据:" + HBillNo); |
| | |
| | | ",HSourceNameList='" + HSourceNameList + "'" + |
| | | ",HWasterQty=" + HWasterQty + |
| | | ",HLastSubProc=" + Convert.ToString(HLastSubProc ? 1 : 0) + |
| | | ",HWasterQty_Work=" + HWasterQty_Work + |
| | | ",HWasterQty_Mater=" + HWasterQty_Mater + |
| | | ",HBackWorkQty=" + HBackWorkQty + |
| | | ",HShiftsID=" + HShiftsID + |
| | | " where HInterID=" + HInterID); |
| | | |
| | | LogService.Write("用户:" + user + ",日期:" + DateTime.Now + ",修改工序出站单据:" + HBillNo); |
| | |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | #region 当前工单(扫码汇报) 条码查询 |
| | | [Route("Cj_StationOutBill_CurrentWork/SNHBardCodeList")] |
| | | [HttpGet] |
| | | public object SNHBardCodeList(string HBarCode, string user, int HOrgID) |
| | | { |
| | | try |
| | | { |
| | | ds = oCN.RunProcReturn(@"select HSourceInterID,HSourceBillNo from Gy_BarCodeBill WITH(NOLOCK) where HBarCode='" + HBarCode + "'", "Gy_BarCodeBill"); |
| | | |
| | | if (ds.Tables[0].Rows.Count > 0) |
| | | { |
| | | string HSourceInterID = ds.Tables[0].Rows[0]["HSourceInterID"].ToString(); |
| | | string HSourceBillNo = ds.Tables[0].Rows[0]["HSourceBillNo"].ToString(); |
| | | |
| | | ds = oCN.RunProcReturn("select * from gy_czygl WITH(NOLOCK) where czymc='" + user + "'", "gy_czygl"); |
| | | string HProcID = ds.Tables[0].Rows[0]["HProcID"].ToString(); |
| | | |
| | | ds = oCN.RunProcReturn("select * from h_v_Sc_ProcessExchangeBillList where hmainid=" + HSourceInterID + " and 单据号='" + HSourceBillNo + "' and HProcID=" + HProcID, "h_v_Sc_ProcessExchangeBillList"); |
| | | |
| | | if (ds.Tables[0].Rows.Count == 0) { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "条码:" + HBarCode + ",流转卡:" + HSourceBillNo + ",与当前流转卡,所对应的工序不存在!"; |
| | | objJsonResult.data = ds.Tables[0]; |
| | | return objJsonResult; |
| | | } |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = ""; |
| | | objJsonResult.data = ds.Tables[0]; |
| | | return objJsonResult; |
| | | } |
| | | else { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "条码查无数据!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "没有返回任何记录!" + e.ToString(); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | #region 当前工单(扫码汇报) 出站单查询 |
| | | [Route("Cj_StationOutBill_CurrentWork/get_Out_Display")] |
| | | [HttpGet] |
| | | public object get_Out_Display(string sWhere, string user,string HBillSubType) |
| | | { |
| | | try |
| | | { |
| | | //判断是否有查询权限 |
| | | if (!DBUtility.ClsPub.Security_Log("Cj_StationOutBill_Query", 1, false, user)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "出站单无查询权限!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | string sql1 = "select * from h_v_MES_StationOutBillList_SN where 1 = 1 "; |
| | | string sql = sql1 + sWhere + " order by 制单日期 desc"; |
| | | ds = oCN.RunProcReturn(sql, "h_v_MES_StationOutBillList_SN"); |
| | | |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "Sucess!"; |
| | | objJsonResult.data = ds.Tables[0]; |
| | | return objJsonResult; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "Exception!" + e.ToString(); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | #region 当前工单(扫码汇报) 子表保存 |
| | | [Route("Cj_StationOutBill_CurrentWork/AddBillSub")] |
| | | [HttpPost] |
| | | public object AddBillSub([FromBody] JObject oMain) |
| | | { |
| | | var _value = oMain["oMain"].ToString(); |
| | | string msg1 = _value.ToString(); |
| | | string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries); |
| | | try |
| | | { |
| | | //反序列化 |
| | | string msg2 = "[" + sArray[0].ToString() + "]"; |
| | | string user = sArray[1].ToString();//用户名 |
| | | string OperationType = sArray[2].ToString();//类型 |
| | | |
| | | if (OperationType == "5") |
| | | { |
| | | //判断是否有编辑权限 |
| | | if (!DBUtility.ClsPub.Security_Log("Cj_StationOutBill_Sub_Edit", 1, false, user)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "完工单无编辑权限!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | //判断是否有编辑权限 |
| | | if (!DBUtility.ClsPub.Security_Log("Cj_StationOutBill_Edit", 1, false, user)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "出站单无编辑权限!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | |
| | | List<StationBill> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<StationBill>>(msg2); |
| | | long HInterID = list[0].HInterID;//递入type得到的单据ID |
| | | string HBillNo = list[0].HBillNo;//递入type得到的单据号 |
| | | double HQty = list[0].HQty;//合格数量 |
| | | long HProcExchInterID = list[0].lngBillKey; |
| | | long HProcExchEntryID = list[0].lngBillSubKey; |
| | | string HProcExchBillNo = list[0].HProcExchBillNo;//流转卡 |
| | | string HBarCode = list[0].HBarCode;//条码 |
| | | string eventType = list[0].eventType; |
| | | |
| | | //若MAINDI重复则重新获取 |
| | | oCN.BeginTran(); |
| | | if ("Add".Equals(eventType)) |
| | | { |
| | | ds = oCN.RunProcReturn("select * from Sc_StationOutBillSub_SN WITH(NOLOCK) where HInterID='" + HInterID + "' order by HEntryID desc", "Sc_StationOutBillSub_SN"); |
| | | |
| | | oCN.RunProc($@"insert into Sc_StationOutBillSub_SN(HInterID,HBillNo_bak,HEntryID,HBarCode,HBarCodeQty,HMakeTime,HRemark,HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney) |
| | | values({HInterID}, '{HBillNo}', {(ds.Tables[0].Rows.Count == 0 ? 1 : int.Parse(ds.Tables[0].Rows[0]["HEntryID"].ToString()) + 1)}, '{HBarCode}', {HQty}, GETDATE(), '', " + HProcExchInterID + "," + HProcExchEntryID + ", '" + HProcExchBillNo + "', '', 0, 0)"); |
| | | |
| | | } |
| | | else |
| | | { |
| | | oCN.RollBack(); |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "操作类型无效!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | oCN.Commit(); |
| | | |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "新增单据成功!"; |
| | | objJsonResult.data = ds.Tables[0]; |
| | | return objJsonResult; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | oCN.RollBack(); |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "Exception!" + e.ToString(); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | #region 当前工单(扫码汇报) 删除出站数据 |
| | | [Route("Cj_StationOutBill_CurrentWork/DelOutBill_SN")] |
| | | [HttpGet] |
| | | public object DelOutBill_SN(int HInterID, string HDeleteMan,string HBillSubType) |
| | | { |
| | | try |
| | | { |
| | | //判断是否有查询权限 |
| | | if (!DBUtility.ClsPub.Security_Log("Cj_StationOutBill_Drop", 1, false, HDeleteMan)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "无删除权限!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | ds = oCN.RunProcReturn("select * from h_v_MES_StationOutBillList_SN WITH(NOLOCK) where hmainid = " + HInterID, "h_v_MES_StationOutBillList_SN"); |
| | | |
| | | if (ds.Tables[0].Rows.Count == 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "查无数据!"; |
| | | objJsonResult.data = null; |
| | | } |
| | | |
| | | oCN.BeginTran(); |
| | | |
| | | string sql = ""; |
| | | if (ds.Tables[0].Rows.Count == 1) |
| | | { |
| | | sql = "delete from Sc_StationOutBillMain where HInterID = " + HInterID; |
| | | oCN.RunProc(sql); |
| | | } |
| | | sql = "delete from Sc_StationOutBillSub_SN where HInterID = " + HInterID ; |
| | | oCN.RunProc(sql); |
| | | |
| | | oCN.Commit(); |
| | | |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "Sucess!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | oCN.RollBack(); |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "Exception!" + e.ToString(); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | #region 当前工单(扫码汇报) 仪表盘查询 |
| | | [Route("Cj_StationOutBill_CurrentWork/get_PanelDisplay")] |
| | | [HttpGet] |
| | | public object get_PanelDisplay(string HBarCode, string user, int HOrgID) |
| | | { |
| | | try |
| | | { |
| | | ds = oCN.RunProcReturn(@"select HSourceInterID,HSourceBillNo from Gy_BarCodeBill WITH(NOLOCK) where HBarCode='" + HBarCode + "'", "Gy_BarCodeBill"); |
| | | |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = ""; |
| | | objJsonResult.data = ds.Tables[0]; |
| | | return objJsonResult; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "没有返回任何记录!" + e.ToString(); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | #region 当前工单(赋码汇报) 根据生产订单查询数据 |
| | | [Route("Cj_StationOutBill_CodingReport/get_ICMOProcessExchangeBillList")] |
| | | [HttpGet] |
| | | public object get_ICMOProcessExchangeBillList(string sWhere, string user, int HOrgID) |
| | | { |
| | | try |
| | | { |
| | | ds = oCN.RunProcReturn("select * from h_v_Sc_ICMOProcessExchangeBillList WITH(NOLOCK) where 1=1 " + sWhere, "h_v_Sc_ICMOProcessExchangeBillList"); |
| | | |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = ""; |
| | | objJsonResult.data = ds.Tables[0]; |
| | | return objJsonResult; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "没有返回任何记录!" + e.ToString(); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | #region 当前工单(赋码汇报) 查询当前用户今天生成条码的数据 |
| | | [Route("Cj_StationOutBill_CodingReport/get_BarCodeBillList")] |
| | | [HttpGet] |
| | | public object get_BarCodeBillList(string sWhere, string user, int HOrgID) |
| | | { |
| | | try |
| | | { |
| | | ds = oCN.RunProcReturn("select * from h_v_IF_BarCodeBillList WITH(NOLOCK) where 1=1 " + sWhere, "h_v_IF_BarCodeBillList"); |
| | | |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = ""; |
| | | objJsonResult.data = ds.Tables[0]; |
| | | return objJsonResult; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "没有返回任何记录!" + e.ToString(); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | #region 当前工单(扫码汇报) 删除出站数据 |
| | | [Route("Cj_StationOutBill_CodingReport/DelBarCodeBill_SN")] |
| | | [HttpGet] |
| | | public object DelBarCodeBill_SN(int HInterID, string HDeleteMan, string HBillSubType) |
| | | { |
| | | try |
| | | { |
| | | //判断是否有查询权限 |
| | | if (!DBUtility.ClsPub.Security_Log("Gy_BarCodeBillList_Edit", 1, false, HDeleteMan)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "无删除权限!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | ds = oCN.RunProcReturn("select * from h_v_IF_BarCodeBillList WITH(NOLOCK) where hmainid = " + HInterID, "h_v_IF_BarCodeBillList"); |
| | | |
| | | if (ds.Tables[0].Rows.Count == 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "查无数据!"; |
| | | objJsonResult.data = null; |
| | | } |
| | | |
| | | oCN.BeginTran(); |
| | | |
| | | string sql = ""; |
| | | sql = "delete from Gy_BarCodeBill where HItemID = " + HInterID; |
| | | oCN.RunProc(sql); |
| | | |
| | | oCN.Commit(); |
| | | |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "Sucess!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | oCN.RollBack(); |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "Exception!" + e.ToString(); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | #endregion |
| | | } |
| | | } |