| | |
| | | #region 工序单品不良采集 扫码查询 |
| | | [Route("Cj_SingleStation/HBardCodeList")] |
| | | [HttpGet] |
| | | public object HBardCodeList(string HBarCode, string user) |
| | | public object HBardCodeList(string HBarCode,int HProcID, string user) |
| | | { |
| | | try |
| | | { |
| | |
| | | return objJsonResult; |
| | | } |
| | | |
| | | 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_Gy_BarCodeBillHICOMProcessExchange WITH(NOLOCK) where 条码='" + HBarCode + "' ", "h_v_Gy_BarCodeBillHICOMProcessExchange"); |
| | | ds = oCN.RunProcReturn(@"select * from h_v_Gy_BarCodeBillHICOMProcessExchange WITH(NOLOCK) where 条码='" + HBarCode + "' and HProcID='"+ HProcID + "' ", "h_v_Gy_BarCodeBillHICOMProcessExchange"); |
| | | |
| | | if (ds.Tables[0].Rows.Count == 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "条码查无数据!"; |
| | | objJsonResult.Message = "条码跟当前工序查无数据!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | int num = 0; |
| | | for (int i = 0; i < ds.Tables[0].Rows.Count; i++) |
| | | { |
| | | if (ds.Tables[0].Rows[i]["HProcID"].ToString() == HProcID) |
| | | { |
| | | num = 1; |
| | | } |
| | | } |
| | | if (num == 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "当前条码与当前工序不匹配!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | //int num = 0; |
| | | //for (int i = 0; i < ds.Tables[0].Rows.Count; i++) |
| | | //{ |
| | | // if (ds.Tables[0].Rows[i]["HProcID"].ToString() == HProcID) |
| | | // { |
| | | // num = 1; |
| | | // } |
| | | //} |
| | | //if (num == 0) |
| | | //{ |
| | | // objJsonResult.code = "0"; |
| | | // objJsonResult.count = 0; |
| | | // objJsonResult.Message = "当前条码与当前工序不匹配!"; |
| | | // objJsonResult.data = null; |
| | | // return objJsonResult; |
| | | //} |
| | | |
| | | if (ds.Tables[0].Rows[0]["HStatus"].ToString() != "正常") |
| | | { |
| | |
| | | //修改条码表的状态 |
| | | oCN.RunProc("update Gy_BarCodeBill set HStatus='"+ HResult + "' where HBarCode='"+ oSub.HBarCode + "'"); |
| | | |
| | | LogService.Write("类型:" + oSub.HBadTypeID + ",制单人:" + oSub.HMaker + ",制单日期:" + oSub.HMakeDate); |
| | | //查询当前条码对应的出站单id |
| | | ds= oCN.RunProcReturn("select * from Sc_StationOutBillSub_SN where HBarCode='" + oSub.HBarCode + "' and HSourceEntryID='" + oSub.HProcExchEntryID + "'", "Sc_StationOutBillSub_SN"); |
| | | if (ds.Tables[0].Rows.Count > 0) |
| | | { |
| | | linterid= ds.Tables[0].Rows[0]["HInterID"].ToString(); |
| | | } |
| | | LogService.Write("类型:" + oSub.HBadTypeID + ",制单人:" + oSub.HMaker + ",制单日期:" + oSub.HMakeDate + ",工序:" + oSub.HProcID + ",流转卡:"+ oSub.HProcExchBillNo + ",出站单id:"+ linterid); |
| | | //修改出站单的 不良 报废数量 |
| | | if (HResult == "不良") |
| | | { |
| | |
| | | if (oSystemParameter.omodel.WMS_CampanyName == "杭州斯莫尔") |
| | | { |
| | | |
| | | //判断当前流转卡是否是开工 |
| | | ds = oCN.RunProcReturn("select * from Sc_ICMOBillStatus_Tmp where HSourceBillNo='" + HBarCode + "' and HICMOStatus<>'0'", "Sc_ICMOBillStatus_Tmp"); |
| | | //判断当前流转卡 当前工序是否是开工 |
| | | ds = oCN.RunProcReturn("select * from Sc_ICMOBillStatus_Tmp where HSourceBillNo='" + HBarCode + "' and HICMOStatus<>'0' and HProcID='"+ HProcID + "'", "Sc_ICMOBillStatus_Tmp"); |
| | | //查不到证明没有开工进入下一句查询 |
| | | if (ds.Tables[0].Rows.Count == 0) |
| | | { |
| | | //判断当前流转卡是否墨西哥的 |
| | |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | ds = oCN.RunProcReturn(@"exec h_p_Gy_BarCodeBillBomList '" + HBarCode + "'," + HProcID, "h_p_Gy_BarCodeBillBomList"); |
| | | //2026 0228斯莫尔 两道工序要合并投料 自动分配 老的 h_p_Gy_BarCodeBillBomList 用于精准查询 新的 h_p_Gy_BarCodeBillBomList2 用于查询出要全部的上料 |
| | | //ds = oCN.RunProcReturn(@"exec h_p_Gy_BarCodeBillBomList '" + HBarCode + "'," + HProcID, "h_p_Gy_BarCodeBillBomList"); |
| | | ds = oCN.RunProcReturn(@"exec h_p_Gy_BarCodeBillBomList2 '" + HBarCode + "'," + HProcID, "h_p_Gy_BarCodeBillBomList2"); |
| | | if (ds.Tables[0].Rows.Count == 0) |
| | | { |
| | | DataSet dataSet = oCN.RunProcReturn(@"exec h_p_Sc_ProcessExchangeBillList '" + HBarCode + "'," + HProcID, "h_p_Sc_ProcessExchangeBillList"); |
| | | //2026 0228斯莫尔 两道工序要合并投料 自动分配 老的 h_p_Sc_ProcessExchangeBillList 用于精准查询 新的 h_p_Sc_ProcessExchangeBillList2 用于查询出要全部的上料 |
| | | //DataSet dataSet = oCN.RunProcReturn(@"exec h_p_Sc_ProcessExchangeBillList '" + HBarCode + "'," + HProcID, "h_p_Sc_ProcessExchangeBillList"); |
| | | |
| | | DataSet dataSet = oCN.RunProcReturn(@"exec h_p_Sc_ProcessExchangeBillList2 '" + HBarCode + "'," + HProcID, "h_p_Sc_ProcessExchangeBillList2"); |
| | | if (dataSet.Tables[0].Rows.Count > 0) |
| | | { |
| | | objJsonResult.code = "2"; |
| | |
| | | sql = "delete from Sc_StationOutBillSub_SN where HInterID = " + HInterID + " and HEntryID = " + HEntryID; |
| | | oCN.RunProc(sql); |
| | | //反写工序出站单的合格数量 |
| | | oCN.RunProc("update Sc_StationOutBillMain WITH (TABLOCKX) set HQty-=1 where HProcExchInterID='" + HProcExchInterID + "' and HProcExchEntryID=" + HProcExchEntryID+ " and HBillNo='"+ HBillNo_bak + "'"); |
| | | oCN.RunProc("update Sc_StationOutBillMain set HQty-=1 where HProcExchInterID='" + HProcExchInterID + "' and HProcExchEntryID=" + HProcExchEntryID+ " and HBillNo='"+ HBillNo_bak + "'"); |
| | | |
| | | |
| | | oCN.Commit(); |
| | |
| | | ds = oCN.RunProcReturn("select * from Sc_SourceLineRepairBillSub_Mater where HInterID=" + model.HInterID+ " order by HEntryID desc", "Sc_SourceLineRepairBillSub_Mater"); |
| | | |
| | | oCN.RunProc($@"insert into Sc_SourceLineRepairBillSub_Mater |
| | | (HInterID,HEntryID,HBillNo_bak,HRemark,HSourceInterID |
| | | ,HSourceEntryID,HSourceBillNo,HSourceBillType,HMaterID |
| | | ,HUnitID,HBarCode,HBatchNo )values |
| | | ({model.HInterID},{(ds.Tables[0].Rows.Count == 0 ? 1 : int.Parse(ds.Tables[0].Rows[0]["HEntryID"].ToString()) + 1)},'{model.HBillNo}','',{temp.HProcExchInterID} |
| | | ,{temp.HProcExchEntryID},'{temp.HProcExchBillNo}','',{temp.HMaterID},0,'{temp.HBarCode}','{temp.HBatchNo}')"); |
| | | (HInterID,HEntryID,HBillNo_bak,HRemark,HSourceInterID |
| | | ,HSourceEntryID,HSourceBillNo,HSourceBillType,HMaterID |
| | | ,HUnitID,HBarCode,HBatchNo )values |
| | | ({model.HInterID},{(ds.Tables[0].Rows.Count == 0 ? 1 : int.Parse(ds.Tables[0].Rows[0]["HEntryID"].ToString()) + 1)},'{model.HBillNo}','',{temp.HProcExchInterID} |
| | | ,{temp.HProcExchEntryID},'{temp.HProcExchBillNo}','',{temp.HMaterID},0,'{temp.HBarCode}','{temp.HBatchNo}')"); |
| | | |
| | | //修改产线追溯单绑定的条码批号 |
| | | oCN.RunProc("update Sc_AssemblyBillSub set HBarCode='" + temp.HBarCode + "' where HInterID=" + temp.HInterID + " and HEntryID=" + temp.HEntryID); |
| | |
| | | model = JsonConvert.DeserializeObject<Model.ClsSc_SourceLineRepairBillMain>(sMainStr); |
| | | |
| | | oCN.RunProc($@"insert into Sc_SourceLineRepairBillMain(HYear, HPeriod, HBillType, HBillSubType, HInterID, |
| | | HDate, HBillNo, HBillStatus, HRemark, HEmpID, HDeptID, HSourceID, HProdOrgID, HMaterID, HWorkStationID, |
| | | HProcess, HIPAddr, HMacAddr, HProdMac, HBarCode,HMaker,HMakeDate,HMainSourceInterID,HMainSourceEntryID,HMainSourceBillNo) |
| | | values('{DateTime.Now.Year}','{DateTime.Now.Month}','3748','3748',{model.HInterID} |
| | | ,getdate(),'{model.HBillNo}','1','{HResult}',{model.HEmpID},{model.HDeptID},{model.HSourceID},{model.HProdOrgID},{model.HMaterID},0 |
| | | ,{model.HProcess},'','','','{model.HBarCode}','{user}',getdate(),{model.HICMOInterID},{model.HICMOEntryID},'{model.HICMOBillNo}')"); |
| | | HDate, HBillNo, HBillStatus, HRemark, HEmpID, HDeptID, HSourceID, HProdOrgID, HMaterID, HWorkStationID, |
| | | HProcess, HIPAddr, HMacAddr, HProdMac, HBarCode,HMaker,HMakeDate,HMainSourceInterID,HMainSourceEntryID,HMainSourceBillNo) |
| | | values('{DateTime.Now.Year}','{DateTime.Now.Month}','3748','3748',{model.HInterID} |
| | | ,getdate(),'{model.HBillNo}','1','{HResult}',{model.HEmpID},{model.HDeptID},{model.HSourceID},{model.HProdOrgID},{model.HMaterID},0 |
| | | ,{model.HProcess},'','','','{model.HBarCode}','{user}',getdate(),{model.HICMOInterID},{model.HICMOEntryID},'{model.HICMOBillNo}')"); |
| | | |
| | | List<Model.ClsSc_SourceLineRepairBillSub> subLsit = new List<Model.ClsSc_SourceLineRepairBillSub>(); |
| | | sMainStr = "[" + sMainStr + "]"; |
| | | subLsit = JsonConvert.DeserializeObject<List<Model.ClsSc_SourceLineRepairBillSub>>(sMainStr); |
| | | |
| | | oCN.RunProc($@"insert into Sc_SourceLineRepairBillSub |
| | | (HInterID,HEntryID,HBillNo_bak,HRemark,HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType |
| | | ,HBadReasonID,HBadTypeID,HBadResultID,HBadProcID,HRepairResult,HCreator,HCreateDate) |
| | | values({model.HInterID},1,'{model.HBillNo}','',{subLsit[0].HProcExchInterID},{subLsit[0].HProcExchEntryID},'{subLsit[0].HProcExchBillNo}','' |
| | | ,{subLsit[0].HBadReasonID},{subLsit[0].HBadTypeID},{subLsit[0].HBadResultID},{model.HBadProcID},'{HResult}','{subLsit[0].HCreator}',getdate())"); |
| | | (HInterID,HEntryID,HBillNo_bak,HRemark,HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType |
| | | ,HBadReasonID,HBadTypeID,HBadResultID,HBadProcID,HRepairResult,HCreator,HCreateDate) |
| | | values({model.HInterID},1,'{model.HBillNo}','{model.HRemark}',{subLsit[0].HProcExchInterID},{subLsit[0].HProcExchEntryID},'{subLsit[0].HProcExchBillNo}','' |
| | | ,{subLsit[0].HBadReasonID},{subLsit[0].HBadTypeID},{subLsit[0].HBadResultID},{model.HBadProcID},'{HResult}','{subLsit[0].HCreator}',getdate())"); |
| | | |
| | | if (HResult == "OK") |
| | | { |
| | |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = ""; |
| | | objJsonResult.data = "没有查询到数据"; |
| | | objJsonResult.Message = "没有查询到数据"; |
| | | objJsonResult.data = ""; |
| | | return objJsonResult; |
| | | } |
| | | |
| | |
| | | #endregion |
| | | |
| | | #region 工序单品过站 关键件绑定配件信息临时存储 |
| | | [Route("Cj_SingleStation/BarCodeBillBomMatch_XW")] |
| | | [Route("Cj_SingleStation/BarCodeBillBomBind_XW")] |
| | | [HttpGet] |
| | | public object PartsBardCode_JX(string HBillNo,string HBarCode, string HBarCode_P, int HProcID, string user, int HOrgID) |
| | | { |
| | |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | #region 工序单品过站 SN镭雕码查询关键件清单(根据流转卡号) |
| | | [Route("Cj_SingleStation/HBardCodeBomListByHProcExch_XW")] |
| | | [HttpGet] |
| | | public object HBardCodeBomListByHProcExch_XW(string HBillNo, string HBarCode, int HProcID, int HOrgID, string user) |
| | | { |
| | | try |
| | | { |
| | | //判断是否有查询权限 |
| | | if (!DBUtility.ClsPub.Security_Log("Cj_StationOutBill_Query", 1, false, user)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "[0000-1-068]无查询权限!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | //条码档案中已有本次扫描的条码,匹配用料清单(扫码数据写入临时表) |
| | | ds = oCN.RunProcReturn(@"exec h_p_Gy_BarCodeBillBomMatchByHProcExch_XW '" + HBillNo + "','" + HBarCode + "','" + HProcID + "'," + HOrgID, "h_p_Gy_BarCodeBillBomMatchByHProcExch_XW"); |
| | | if (ds != null && ds.Tables[0].Rows.Count > 0) |
| | | { |
| | | if (ClsPub.isLong(ds.Tables[0].Rows[0]["HBack"]) != 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]); |
| | | objJsonResult.data = ""; |
| | | return objJsonResult; |
| | | } |
| | | else |
| | | { |
| | | 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 = ""; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "[0000-1-010]没有返回任何记录!" + e.ToString(); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | #region 工序单品过站 关键件绑定配件信息临时存储(根据流转卡号) |
| | | [Route("Cj_SingleStation/BarCodeBillBomBindByHProcExch_XW")] |
| | | [HttpGet] |
| | | public object BarCodeBillBomBindByHProcExch_XW(string HBillNo, string HBarCode, string HBarCode_P, int HProcID, string user, int HOrgID) |
| | | { |
| | | try |
| | | { |
| | | //判断所扫条码是否存在条码档案当中 |
| | | //ds = oCN.RunProcReturn(@"select 1 from Gy_BarCodeBill WITH(NOLOCK) where HBarCode='" + HBarCode + "'", "Gy_BarCodeBill"); |
| | | //if (ds.Tables[0].Rows.Count == 0) |
| | | //{ |
| | | // //条码档案中没有本次扫描的条码,则根据规则解析生成条码 |
| | | |
| | | // objJsonResult.code = "0"; |
| | | // objJsonResult.count = 0; |
| | | // objJsonResult.Message = "该条码不存在:" + HBarCode; |
| | | // objJsonResult.data = ""; |
| | | // return objJsonResult; |
| | | |
| | | //} |
| | | |
| | | //条码档案中已有本次扫描的条码,查询配件信息(扫描条码信息写入临时表) |
| | | ds = oCN.RunProcReturn(@"exec h_p_Gy_BarCodeBillBomBindByHProcExch_XW '" + HBillNo + "','" + HBarCode + "','" + HBarCode_P + "','" + HProcID + "','" + HOrgID + "'", "h_p_Gy_BarCodeBillBomBindByHProcExch_XW"); |
| | | |
| | | if (ds != null && ds.Tables[0].Rows.Count > 0) |
| | | { |
| | | if (ClsPub.isLong(ds.Tables[0].Rows[0]["HBack"]) != 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]); |
| | | objJsonResult.data = ""; |
| | | return objJsonResult; |
| | | } |
| | | else |
| | | { |
| | | 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 = "没有查询到数据"; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "ERROR!" + e.ToString(); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | |
| | | #region 工序单品过站 扫SN码出站保存(保存到出站汇报里(+关键件绑定)) |
| | | [Route("Cj_SingleStation/AddStationOutBillAndAssemblyBill")] |
| | |
| | | |
| | | if (sWhere == null || sWhere.Equals("")) |
| | | { |
| | | ds = oCN.RunProcReturn("select * from h_v_Sc_UnbindStation_BarList order by 条码日期 desc", "h_v_Sc_UnbindStation_BarList"); |
| | | ds = oCN.RunProcReturn("select * from h_v_Sc_UnbindStation_BarList" + |
| | | " order by 条码日期 desc", "h_v_Sc_UnbindStation_BarList"); |
| | | } |
| | | else |
| | | { |
| | | string sql1 = "select * from h_v_Sc_UnbindStation_BarList where 1 = 1 "; |
| | | string sql = sql1 + sWhere + " order by 条码日期 desc"; |
| | | ds = oCN.RunProcReturn(sql, "h_v_Sc_UnbindStation_BarList"); |
| | | } |
| | | |
| | | //添加列名 |
| | | foreach (DataColumn col in ds.Tables[0].Columns) |
| | | { |
| | | Type dataType = col.DataType; |
| | | string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}"; |
| | | columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//获取到DataColumn列对象的列名 |
| | | } |
| | | |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "Sucess!"; |
| | | objJsonResult.data = ds.Tables[0]; |
| | | objJsonResult.list = columnNameList; |
| | | 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_SingleStation/ShippingExportList")] |
| | | [HttpGet] |
| | | public object ShippingExportList(string sWhere, string user, string gnsy) |
| | | { |
| | | try |
| | | { |
| | | List<object> columnNameList = new List<object>(); |
| | | if (gnsy != "" && gnsy != null) |
| | | { |
| | | //查看权限 |
| | | if (!DBUtility.ClsPub.Security_Log(gnsy, 1, false, user)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "无查看权限!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | |
| | | if (sWhere == null || sWhere.Equals("")) |
| | | { |
| | | ds = oCN.RunProcReturn("select * from h_v_Cj_SingleStation_ShippingExportList" + |
| | | " order by 栈板码 desc,中箱码,SN码", "h_v_Cj_SingleStation_ShippingExportList"); |
| | | } |
| | | else |
| | | { |
| | | string sql1 = "select * from h_v_Cj_SingleStation_ShippingExportList where 1 = 1 "; |
| | | string sql = sql1 + sWhere + " order by 栈板码 desc,中箱码,SN码"; |
| | | ds = oCN.RunProcReturn(sql, "h_v_Cj_SingleStation_ShippingExportList"); |
| | | } |
| | | |
| | | //添加列名 |
| | |
| | | } |
| | | #endregion |
| | | |
| | | #region 香囊标签生成 |
| | | [Route("Cj_SingleStation/SachetBarCodeSave")] |
| | | [HttpGet] |
| | | public object SachetBarCodeSave(int HICMOInterID,int HICMOEntryID, string user) |
| | | { |
| | | try |
| | | { |
| | | //生成权限 |
| | | if (!DBUtility.ClsPub.Security_Log("Gy_BarCodeBill", 1, false, user)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "无条码生成权限!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | string sql = "exec h_p_Cj_SachetBarCodeSave " + HICMOInterID + "," + HICMOEntryID + ",'" + user + "'"; |
| | | |
| | | oCN.BeginTran(); |
| | | ds = oCN.RunProcReturn(sql, "h_p_Cj_SachetBarCodeSave"); |
| | | oCN.Commit(); |
| | | |
| | | if (ds.Tables[0].Rows.Count > 0) |
| | | { |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "Sucess!"; |
| | | objJsonResult.data = ds.Tables[0]; |
| | | return objJsonResult; |
| | | } |
| | | else |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "没有返回相关香囊条码信息"; |
| | | objJsonResult.data = ""; |
| | | 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_SingleStation/BlueToothBarCodeSave")] |
| | | [HttpGet] |
| | | public object BlueToothBarCodeSave(string HBarCode, int HMaterID,int HOrgID ,string user) |
| | | { |
| | | try |
| | | { |
| | | //生成权限 |
| | | if (!DBUtility.ClsPub.Security_Log("Gy_BarCodeBill", 1, false, user)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "无条码生成权限!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | string sql = "exec h_p_Cj_BlueToothBarCodeSave '" + HBarCode + "'," + HMaterID + "," + HOrgID + ",'" + user + "'"; |
| | | |
| | | oCN.BeginTran(); |
| | | ds = oCN.RunProcReturn(sql, "h_p_Cj_BlueToothBarCodeSave"); |
| | | oCN.Commit(); |
| | | if (ClsPub.isInt(ds.Tables[0].Rows.Count) == 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "保存失败没有返回任何内容!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | else if (ds.Tables[0].Rows[0]["HBack"].ToString() == "1") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "[0000-1-051]保存失败" + ds.Tables[0].Rows[0]["HBackRemark"].ToString() + "!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "[0000-1-050]保存成功!"; |
| | | objJsonResult.data = "";// |
| | | 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_SingleStation/BluetoothTestDataSave")] |
| | | [HttpGet] |
| | | public object BluetoothTestDataSave(string lotSn, string testData) |
| | | { |
| | | try |
| | | { |
| | | //判断有没有过打印记录(条码档案中存不存在蓝牙mac地址) |
| | | ds = oCN.RunProcReturn("select 1 from Gy_BarCodeBill with(nolock) where HBarCode = '" + lotSn + "'", "Gy_BarCodeBill"); |
| | | if (ds.Tables[0].Rows.Count < 1) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "上传的lotSn:" + lotSn + ",没有标签打印记录,请先打印蓝牙mac标签" ; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | string sql = string.Format($@"insert into Gy_BluetoothTestData(HBluetooth_Mac,HResult,HMakeDate) values ('{lotSn}','{testData}',getdate() ) "); |
| | | |
| | | oCN.RunProc(sql);//插入蓝牙测试数据 |
| | | |
| | | objJsonResult.code = "success"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "蓝牙测试数据接收成功!lotSn:" + lotSn; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | objJsonResult.code = "error"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "发生异常!" + e.ToString(); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | #region 小卫组托缓存 查询 |
| | | [Route("Cj_SingleStation/xiaoweizutuo_CacheList")] |
| | | [HttpGet] |
| | | public object xiaoweizutuo_CacheList(string sWhere, string user, string gnsy) |
| | | { |
| | | try |
| | | { |
| | | List<object> columnNameList = new List<object>(); |
| | | if (gnsy != "" && gnsy != null) |
| | | { |
| | | //查看权限 |
| | | if (!DBUtility.ClsPub.Security_Log(gnsy, 1, false, user)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "无查看权限!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | |
| | | if (sWhere == null || sWhere.Equals("")) |
| | | { |
| | | ds = oCN.RunProcReturn("select * from h_v_Sc_PackUnionBill_Temp" + |
| | | " order by 栈板码 desc,中箱码,SN码", "h_v_Sc_PackUnionBill_Temp"); |
| | | } |
| | | else |
| | | { |
| | | string sql1 = "select * from h_v_Sc_PackUnionBill_Temp where 1 = 1 "; |
| | | string sql = sql1 + sWhere + " order by 栈板码 desc,中箱码,SN码"; |
| | | ds = oCN.RunProcReturn(sql, "h_v_Sc_PackUnionBill_Temp"); |
| | | } |
| | | |
| | | //添加列名 |
| | | foreach (DataColumn col in ds.Tables[0].Columns) |
| | | { |
| | | Type dataType = col.DataType; |
| | | string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}"; |
| | | columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//获取到DataColumn列对象的列名 |
| | | } |
| | | |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "Sucess!"; |
| | | objJsonResult.data = ds.Tables[0]; |
| | | objJsonResult.list = columnNameList; |
| | | return objJsonResult; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "Exception!" + e.ToString(); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | #region 小卫组托缓存 删除 |
| | | /// <summary> |
| | | ///参数:string HInterID。 |
| | | ///返回值:object。 |
| | | /// </summary> |
| | | [Route("Cj_SingleStation/deleteBill")] |
| | | [HttpGet] |
| | | public object deleteBill(string HInterID, string user,string gnsy) |
| | | { |
| | | try |
| | | { |
| | | if (gnsy != "" && gnsy != null) |
| | | { |
| | | //查看权限 |
| | | if (!DBUtility.ClsPub.Security_Log(gnsy, 1, false, user)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "无查看权限!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | |
| | | if (HInterID == null || HInterID.Equals("")) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "HInterID不能为空!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | oCN.BeginTran(); |
| | | |
| | | oCN.RunProc("delete from Sc_PackUnionBill_Temp where HInterID = " + HInterID); |
| | | |
| | | |
| | | oCN.Commit(); |
| | | |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "Sucess!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "Exception!" + e.ToString(); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | #endregion |
| | | |