| | |
| | | using Newtonsoft.Json; |
| | | using Newtonsoft.Json.Linq; |
| | | using Pub_Class; |
| | | using SyntacticSugar.constant; |
| | | using System; |
| | | using System.Collections; |
| | | using System.Collections.Generic; |
| | |
| | | else |
| | | { |
| | | string sql1 = "select * from h_v_MES_StationEntrustInBillList where 1 = 1 "; |
| | | string sql = sql1 + sWhere+ " order by hmainid desc"; |
| | | string sql = sql1 + sWhere + " order by hmainid desc"; |
| | | ds = oCN.RunProcReturn(sql, "h_v_MES_StationEntrustInBillList"); |
| | | } |
| | | |
| | |
| | | columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//获取到DataColumn列对象的列名 |
| | | } |
| | | |
| | | //if (ds.Tables[0].Rows.Count != 0 || ds != null) |
| | | //{ |
| | | |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "Sucess!"; |
| | | objJsonResult.list = columnNameList; |
| | | objJsonResult.data = ds.Tables[0]; |
| | | return objJsonResult; |
| | | //} |
| | | //else |
| | | //{ |
| | | //objJsonResult.code = "0"; |
| | | //objJsonResult.count = 0; |
| | | //objJsonResult.Message = "无数据"; |
| | | //objJsonResult.data = null; |
| | | //return objJsonResult; |
| | | //} |
| | | } |
| | | catch (Exception e) |
| | | { |
| | |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | #region 委外发出单 分页列表 |
| | | [Route("Cj_StationEntrustInBill/getStationEntrustInBillPage")] |
| | | [HttpGet] |
| | | public json getStationEntrustInBillPage(string sWhere, string user, int page, int size) |
| | | { |
| | | DataSet ds; |
| | | json res = new json(); |
| | | try |
| | | { |
| | | List<object> columnNameList = new List<object>(); |
| | | //判断权限 |
| | | if (!DBUtility.ClsPub.Security_Log("MES_StationEntrustInBill_Query", 1, false, user)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "无权限查询!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | sWhere = sWhere.Replace("'", "''"); |
| | | if (sWhere == null || sWhere.Equals("")) |
| | | { |
| | | ds = oCN.RunProcReturn("exec h_p_Sc_StationEntrustInBillList " + page + "," + size + ",''", "h_p_Sc_StationEntrustInBillList"); |
| | | } |
| | | else |
| | | { |
| | | ds = oCN.RunProcReturn("exec h_p_Sc_StationEntrustInBillList " + page + "," + size + ",'" + sWhere + "'", "h_p_Sc_StationEntrustInBillList"); |
| | | } |
| | | |
| | | //添加列名 |
| | | 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列对象的列名 |
| | | } |
| | | |
| | | res.code = CodeConstant.SUCCEED; |
| | | res.count = int.Parse(ds.Tables[1].Rows[0]["count"].ToString()); |
| | | res.Message = "Sucess!"; |
| | | res.list = columnNameList; |
| | | res.data = ds.Tables[0]; |
| | | return res; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | res.code = CodeConstant.FAIL; |
| | | res.count = CountConstant.FAIL; |
| | | res.Message = "Exception!" + e.ToString(); |
| | | res.data = null; |
| | | return res; |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | |
| | | |
| | | #region 委外工序发出单流水号回车获取流转卡信息(委外工序接收、工序进站接收通用) |
| | | [Route("Cj_StationEntrustInBill/txtHBarCode_KeyDown")] |
| | |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "空白码,条形码不能为空!"; |
| | | objJsonResult.Message = "[0000-2-019]空白码,条形码不能为空!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | |
| | | entryid_PGD = arr[1]; |
| | | } |
| | | |
| | | //截取条码类型 前两位 |
| | | string BillNoType1 = BillNo_PGD.Substring(0, Math.Min(2, BillNo_PGD.Length)); |
| | | //截取条码类型 前三位 |
| | | string BillNoType = BillNo_PGD.Substring(0, Math.Min(3, BillNo_PGD.Length)); |
| | | //截取条码类型2 前四位 |
| | | string BillNoType2 = BillNo_PGD.Substring(0, Math.Min(4, BillNo_PGD.Length)); |
| | | //截取内码 |
| | | string BillNo = BillNo_PGD.Substring(3, Math.Min(BillNo_PGD.Length - 3, BillNo_PGD.Length)); |
| | | switch (BillNoType1) |
| | | { |
| | | case "20"://流转卡 |
| | | string sErr = ""; |
| | | if (oSystemParameter.ShowBill(ref sErr)) |
| | | { |
| | | if (oSystemParameter.omodel.WMS_CampanyName == "杭州斯莫尔") |
| | | { |
| | | ds = oCN.RunProcReturn("select top 1 * from h_v_Sc_ProcessExchangeBillList where 单据号= '" + BillNo_PGD + "'", "h_v_Sc_ProcessExchangeBillList"); |
| | | } |
| | | } |
| | | break; |
| | | } |
| | | |
| | | switch (BillNoType2) |
| | | { |
| | | case "GXLZ"://工序流转派工 |
| | |
| | | } |
| | | } |
| | | break; |
| | | case "P202"://流转卡 |
| | | case "P203"://流转卡 |
| | | case "P204"://流转卡 |
| | | case "P205"://流转卡 |
| | | case "P201"://流转卡 |
| | | ds = oCN.RunProcReturn("select top 1 * from h_v_Sc_ProcessExchangeBillList where 单据号= '" + BillNo_PGD + "'", "h_v_Sc_ProcessExchangeBillList"); |
| | | break; |
| | | } |
| | | switch (BillNoType) |
| | | //得到信息 |
| | | { |
| | | case "HCX"://生产资源码 |
| | | ds = oCN.RunProcReturn("select * from h_v_Gy_SourceList where 条码编号 = '" + BillNo + "'", "h_v_Gy_SourceList"); |
| | | case "htt"://生产资源码 |
| | | |
| | | string sErr = ""; |
| | | if (oSystemParameter.ShowBill(ref sErr)) |
| | | { |
| | | if (oSystemParameter.omodel.WMS_CampanyName == "杭州斯莫尔") |
| | | { |
| | | ds = oCN.RunProcReturn(@"select s.HItemID,s.HName 生产资源名称,s.HNumber from Gy_EquipFileBillMain a |
| | | left join Gy_Source s on a.HSourceID = s.HItemID |
| | | where HBarCode = '" + BillNo_PGD + "'", "Gy_EquipFileBillMain"); |
| | | } |
| | | else { |
| | | ds = oCN.RunProcReturn("select * from h_v_Gy_SourceList where 条码编号 = '" + BillNo + "'", "h_v_Gy_SourceList"); |
| | | } |
| | | } |
| | | |
| | | break; |
| | | case "SBM"://设备码 |
| | | ds = oCN.RunProcReturn("select * from h_v_Gy_EquipMentList where HItemID = '" + BillNo + "'", "h_v_Gy_EquipMentList"); |
| | |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "未查询到条码信息!"; |
| | | objJsonResult.Message = "[0000-2-020]未查询到条码信息!"; |
| | | objJsonResult.data = null; |
| | | if(BillNoType == "PRO") |
| | | { |
| | | ds = oCN.RunProcReturn("select * from h_v_Gy_ProcessList where HItemID = '" + BillNo + "'", "h_v_Gy_ProcessList"); |
| | | if (ds == null || ds.Tables[0].Rows.Count == 0) |
| | | { |
| | | objJsonResult.Message = "未查询到条码信息!"; |
| | | objJsonResult.Message = "[0000-2-020]未查询到条码信息!"; |
| | | } |
| | | else |
| | | { |
| | | objJsonResult.Message = "用户未关联相关工序或流转卡无此工序,如有需要请维护"; |
| | | objJsonResult.Message = "[3790-2-010]用户未关联相关工序或流转卡无此工序,如有需要请维护"; |
| | | } |
| | | } |
| | | return objJsonResult; |
| | | } |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "[0000-1-037]Sucess!"; |
| | | objJsonResult.data = ds.Tables[0]; |
| | | return objJsonResult; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "[0000-1-038]Exception!" + e.ToString(); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | #region 工序出站汇报单PDA扫操作员 |
| | | [Route("Cj_StationBill/txtHBarCode_KeyDown_Operator")] |
| | | [HttpGet] |
| | | public object txtHBarCode_KeyDown_Operator(string HBarCode, string HInterID, string UserID, string HBillType) |
| | | { |
| | | try |
| | | { |
| | | if (HBarCode == null || HBarCode.Equals("")) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "空白码,条形码不能为空!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | ds = oCN.RunProcReturn("select * from h_v_Gy_EmployeeList_New where 职员代码 = '" + HBarCode + "'", "h_v_Gy_EmployeeList_New"); |
| | | |
| | | //写入信息 |
| | | if (ds == null || ds.Tables[0].Rows.Count == 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "未查询到条码信息!"; |
| | | objJsonResult.data = null; |
| | | |
| | | return objJsonResult; |
| | | } |
| | | objJsonResult.code = "1"; |
| | |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "空白码,条形码不能为空!"; |
| | | objJsonResult.Message = "[0000-2-019]空白码,条形码不能为空!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "未查询到条形码信息!"; |
| | | objJsonResult.Message = "[0000-2-020]未查询到条形码信息!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "错误!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0][1]); |
| | | objJsonResult.Message = "[0000-1-038]错误!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0][1]); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "刷新失败,无数据显示!"; |
| | | objJsonResult.Message = "[0000-1-045]刷新失败,无数据显示!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "查无数据!"; |
| | | objJsonResult.Message = "[0000-1-045]查无数据!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "绑定成功!"; |
| | | objJsonResult.Message = "[0000-1-037]绑定成功!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "Exception!" + e.ToString(); |
| | | objJsonResult.Message = "[0000-1-038]Exception!" + e.ToString(); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | |
| | | long HProcID = list[0].HProcID;//工序ID |
| | | long HPRDORGID = list[0].HPRDORGID;//组织ID |
| | | bool HLastResult = list[0].HLastResult;//试样结论 |
| | | long HQCSchemeID = list[0].HQCSchemeID;//检验方案 |
| | | long HProcExchInterID = list[0].HProcExchInterID;//流转卡ID |
| | | long HProcExchEntryID = list[0].HProcExchEntryID;//流转卡子ID |
| | | string HBatchNo = list[0].HBatchNo;//流转卡批次号 |
| | | long HMainSourceInterID = list[0].HMainSourceInterID;//源单ID |
| | | long HMainSourceEntryID = list[0].HMainSourceEntryID;//源单子ID |
| | | string HMainSourceBillNo = list[0].HMainSourceBillNo;//源单单号 |
| | |
| | | oSub.HAnalysisMethod = DBUtility.ClsPub.isStrNull(subList[i].HAnalysisMethod); |
| | | oSub.HKeyInspect = DBUtility.ClsPub.isLong(subList[i].HKeyInspect); |
| | | oSub.HInspectInstruMentID = DBUtility.ClsPub.isLong(subList[i].HInspectInstruMentID); |
| | | oSub.HInspectResult = DBUtility.ClsPub.isStrNull(subList[i].HResult == "true" ? 1 : 0); |
| | | oSub.HInspectResult = DBUtility.ClsPub.isStrNull(subList[i].HResult == "True" ? 1 : 0); |
| | | |
| | | oSub.HQCNote = DBUtility.ClsPub.isStrNull(subList[i].HQCNote);//检验记录 |
| | | oSub.HMax = DBUtility.ClsPub.isStrNull(subList[i].HMax); |
| | | oSub.HMin = DBUtility.ClsPub.isStrNull(subList[i].HMin); |
| | | oSub.HAvg = DBUtility.ClsPub.isStrNull(subList[i].HAvg); |
| | | |
| | | |
| | | |
| | | BillNew.DetailColl.Add(oSub); |
| | | } |
| | |
| | | oCN.RunProc("Insert Into QC_FirstPieceCheckBillMain " + |
| | | "(HBillType,HBillSubType,HInterID,HBillNo,HBillStatus,HDate,HMaker,HMakeDate" + |
| | | ",HYear,HPeriod,HMaterID,HSourceID,HICMOInterID,HICMOEntryID,HICMOBillNo,HProcExchBillNo" + |
| | | ",HPRDORGID,HLastResult,HProcExchInterID,HProcExchEntryID,HMainSourceInterID,HMainSourceEntryID,HMainSourceBillNo,HMainSourceBillType)" + |
| | | ",HPRDORGID,HLastResult,HProcID,HQCSchemeID,HBatchNo," + |
| | | "HProcExchInterID,HProcExchEntryID,HMainSourceInterID,HMainSourceEntryID,HMainSourceBillNo,HMainSourceBillType)" + |
| | | " values('" + BillType + "','" + HBillSubType + "'," + HInterID + ",'" + HBillNo + "'," + HBillStatus + ",getdate(),'" + HMaker + "',getdate()" + |
| | | "," + HYear + "," + HPeriod + ",'" + HMaterID + "','" + HSourceID + "'," + HICMOInterID + "," + HICMOEntryID + ",'" + HICMOBillNo + "','" + HProcExchBillNo + "'" + |
| | | "," + HPRDORGID + ",'" + HLastResult + "'," + HProcExchInterID + "," + HProcExchEntryID + "," + HMainSourceInterID + "," + HMainSourceEntryID + ",'" + HMainSourceBillNo + "','" + HMainSourceBillType + "'" + ") "); |
| | | "," + HPRDORGID + ",'" + HLastResult + "','" + HProcID + "','" + HQCSchemeID + "','" + HBatchNo + "'," + |
| | | "" + HProcExchInterID + "," + HProcExchEntryID + "," + HMainSourceInterID + "," + HMainSourceEntryID + ",'" + HMainSourceBillNo + "','" + HMainSourceBillType + "'" + ") "); |
| | | |
| | | //插入子表 |
| | | foreach (Model.ClsQC_FirstPieceCheckBillSub oSub in BillNew.DetailColl) |
| | | { |
| | | string sql = "Insert into QC_FirstPieceCheckBillSub " + |
| | | " (HInterID,HBillNo_bak,HEntryID" + |
| | | ",HRemark,HSourceInterID" + |
| | | ",HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney" + |
| | | ",HQCCheckItemID,HQCStd,HResult" + |
| | | ",HStatus,HUnitID,HKeyInspect,HAnalysisMethod,HInspectInstruMentID,HInspectResult," + |
| | | "HQCNote,HMax,HMin,HAvg" + |
| | | ") values(" |
| | | + HInterID.ToString() + ",'" + oSub.HBillNo_bak + "'," + oSub.HEntryID.ToString() + ",'" + oSub.HRemark + "'," + HMainSourceInterID.ToString() + |
| | | "," + HMainSourceEntryID.ToString() + ",'" + HMainSourceBillNo + "','" + HMainSourceBillType + "'," + oSub.HRelationQty.ToString() + "," + oSub.HRelationMoney.ToString() + |
| | | "," + oSub.HQCCheckItemID.ToString() + ",'" + oSub.HQCStd + "','" + oSub.HResult + "'" + |
| | | ",'" + oSub.HStatus + "'," + oSub.HUnitID + "," + oSub.HKeyInspect + ",'" + oSub.HAnalysisMethod + "'," + oSub.HInspectInstruMentID + ",'" + oSub.HInspectResult + "'" + |
| | | ",'" + oSub.HQCNote + "','" + oSub.HMax + "','" + oSub.HMin + "','" + oSub.HAvg + "'" + |
| | | ")"; |
| | | |
| | | oCN.RunProc("Insert into QC_FirstPieceCheckBillSub " + |
| | | " (HInterID,HBillNo_bak,HEntryID" + |
| | | ",HRemark,HSourceInterID" + |
| | | ",HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney" + |
| | | ",HQCCheckItemID,HQCStd,HResult" + |
| | | ",HStatus,HUnitID,HKeyInspect,HAnalysisMethod,HInspectInstruMentID,HInspectResult" + |
| | | ",HStatus,HUnitID,HKeyInspect,HAnalysisMethod,HInspectInstruMentID,HInspectResult," + |
| | | "HQCNote,HMax,HMin,HAvg" + |
| | | ") values(" |
| | | + HInterID.ToString() + ",'" + oSub.HBillNo_bak + "'," + oSub.HEntryID.ToString() + ",'" + oSub.HRemark + "'," + HMainSourceInterID.ToString() + |
| | | "," + HMainSourceEntryID.ToString() + ",'" + HMainSourceBillNo + "','" + HMainSourceBillType + "'," + oSub.HRelationQty.ToString() + "," + oSub.HRelationMoney.ToString() + |
| | | "," + oSub.HQCCheckItemID.ToString() + ",'" + oSub.HQCStd + "','" + oSub.HResult + "'" + |
| | | ",'" + oSub.HStatus + |
| | | "'," + oSub.HUnitID + "," + oSub.HKeyInspect + ",'" + oSub.HAnalysisMethod + "'," + oSub.HInspectInstruMentID + ",'" + oSub.HInspectResult + "'" + |
| | | ",'" + oSub.HStatus + "'," + oSub.HUnitID + "," + oSub.HKeyInspect + ",'" + oSub.HAnalysisMethod + "'," + oSub.HInspectInstruMentID + ",'" + oSub.HInspectResult + "'" + |
| | | ",'" + oSub.HQCNote + "','" + oSub.HMax + "','" + oSub.HMin + "','" + oSub.HAvg + "'" + |
| | | ") "); |
| | | } |
| | | } |
| | |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "用户编码不能为空!"; |
| | | objJsonResult.Message = "[0000-2-021]用户编码不能为空!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "未查询到工序信息!"; |
| | | objJsonResult.Message = "[0000-2-022]未查询到工序信息!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "Sucess!"; |
| | | objJsonResult.Message = "[0000-1-037]Sucess!"; |
| | | objJsonResult.data = ds.Tables[0]; |
| | | return objJsonResult; |
| | | } |
| | |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "Exception!" + e.ToString(); |
| | | objJsonResult.Message = "[0000-1-038]Exception!" + e.ToString(); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "手动输入模式"; |
| | | objJsonResult.Message = "[0000-2-024]手动输入模式"; |
| | | objJsonResult.data = ""; |
| | | return objJsonResult; |
| | | } |
| | |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "用户编码不能为空!"; |
| | | objJsonResult.Message = "[0000-2-021]用户编码不能为空!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "未查询到工序信息!"; |
| | | objJsonResult.Message = "[0000-2-022]未查询到工序信息!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "Exception!" + e.ToString(); |
| | | objJsonResult.Message = "[0000-1-038]Exception!" + e.ToString(); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "手动输入模式"; |
| | | objJsonResult.Message = "[0000-2-024]手动输入模式"; |
| | | objJsonResult.data = ""; |
| | | return objJsonResult; |
| | | } |
| | |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "系统参数异常"; |
| | | objJsonResult.Message = "[0000-2-023]系统参数异常"; |
| | | objJsonResult.data = ""; |
| | | return objJsonResult; |
| | | } |
| | |
| | | return objJsonResult; |
| | | } |
| | | //若MAINDI重复则重新获取 |
| | | oCN.BeginTran(); |
| | | oCN.BeginTran(); |
| | | |
| | | if ("Add".Equals(eventType)) |
| | | { |
| | | if (!AllowbillNo(HBillNo)) |
| | |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | //保存前控制========================================= |
| | | string HBillNote = ""; |
| | | ds = oCN.RunProcReturn("Exec h_p_Sc_StationInBill_WW_BeforeSaveCtrl " + HInterID.ToString() + ", '" + HBillNo + "','" + HBillNote + "',1 ", "h_p_Sc_StationInBill_WW_BeforeSaveCtrl "); |
| | | if (ds == null) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "保存前判断失败!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "保存失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | //========================================================= |
| | | |
| | | //主表 |
| | | oCN.RunProc("Insert Into Sc_StationInBillMain " + |
| | | "(HBillType,HBillSubType,HInterID,HBillNo,HBillStatus,HDate,HMaker,HMakeDate" + |
| | |
| | | "," + HSupID + "," + HTaxRate + "," + HQty + "," + HPrice + "," + HMoney + "," + HPieceQty + |
| | | ",'" + HProcNo + "','" + HOrderProcNO + "'" + ",'" + HWWWorkOrderBillNo + "'" + "," + HWWWorkOrderInterID + "" + "," + HWWWorkOrderEntryID + "," + HMainInterID + "," + HPRDOrgID + |
| | | ") "); |
| | | |
| | | //=========================保存后控制 ============================ |
| | | DataSet ds2 = oCN.RunProcReturn("Exec h_p_Sc_StationInBill_WW_AfterSaveCtrl " + HInterID.ToString() + ", '" + HBillNo + "',2 ", "h_p_Sc_StationInBill_WW_AfterSaveCtrl"); |
| | | if (ds2 == null) |
| | | { |
| | | oCN.RollBack(); |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "保存后控制判断失败!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | |
| | | } |
| | | if (DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBack"]) != "0") |
| | | { |
| | | oCN.RollBack(); |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "保存失败2!" + DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBackRemark"]); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | //======================================================= |
| | | |
| | | } |
| | | else if ("Modify".Equals(eventType)) |
| | | { |
| | | |
| | | //保存前控制========================================= |
| | | string HBillNote = ""; |
| | | ds = oCN.RunProcReturn("Exec h_p_Sc_StationInBill_WW_BeforeSaveCtrl " + HInterID.ToString() + ", '" + HBillNo + "','" + HBillNote + "',2 ", "h_p_Sc_StationInBill_WW_BeforeSaveCtrl "); |
| | | if (ds == null) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "保存前判断失败!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "保存失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | //========================================================= |
| | | |
| | | //删除关联 |
| | | oCN.RunProc("exec h_p_Mes_ProcessExchangeRelationQty_In " + HInterID + ",-1"); |
| | |
| | | ",HProcNo=" + HProcNo + |
| | | ",HOrderProcNO='" + HOrderProcNO + "'" + |
| | | " where HInterID=" + HInterID); |
| | | |
| | | //=========================保存后控制 ============================ |
| | | DataSet ds2 = oCN.RunProcReturn("Exec h_p_Sc_StationInBill_WW_AfterSaveCtrl " + HInterID.ToString() + ", '" + HBillNo + "',2", "h_p_Sc_StationInBill_WW_AfterSaveCtrl"); |
| | | if (ds2 == null) |
| | | { |
| | | oCN.RollBack(); |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "保存后控制判断失败!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | |
| | | } |
| | | if (DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBack"]) != "0") |
| | | { |
| | | oCN.RollBack(); |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "保存失败2!" + DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBackRemark"]); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | //======================================================= |
| | | |
| | | } |
| | | else |
| | | { |
| | |
| | | } |
| | | oCN.RunProc("exec h_p_Mes_ProcessExchangeRelationQty_In " + HInterID.ToString() + ",1"); |
| | | oCN.RunProc("exec h_p_WW_EntrustWorkOrderRelationQty_In " + HInterID.ToString() + ",1"); |
| | | |
| | | |
| | | |
| | | oCN.Commit(); |
| | | string sReturn = ""; |
| | | if (oSystemParameter.ShowBill(ref sReturn) == true) |
| | |
| | | { |
| | | try |
| | | { |
| | | //ds = oCN.RunProcReturn("exec h_p_MES_StationInBill_DelCtrl '" + HBillNo + "'", "h_p_MES_StationInBill_DelCtrl"); |
| | | //if (ds == null || 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.Count > 0 && Pub_Class.ClsPub.isInt(ds.Tables[0].Rows[0][0]) == 2) |
| | | //{ |
| | | // objJsonResult.code = "0"; |
| | | // objJsonResult.count = 0; |
| | | // objJsonResult.Message = Pub_Class.ClsPub.isStrNull(ds.Tables[0].Rows[0][1]); |
| | | // objJsonResult.data = null; |
| | | // return objJsonResult; |
| | | //} |
| | | |
| | | |
| | | //判断权限 |
| | | if (!ClsPub.Security_Log_second("MES_StationEntrustInBill_Edit", 1, false, CurUserName)) |
| | | { |
| | |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | //审核前控制================================================================================ |
| | | string sql = "exec h_p_Sc_StationInBill_WW_BeforeCheckCtrl " + HInterID + ",'" + oBill.omodel.HBillNo + "','" + CurUserName + "'"; |
| | | ds = oCN.RunProcReturn(sql, "h_p_Sc_StationInBill_WW_BeforeCheckCtrl"); |
| | | if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "审核失败!原因:审核前判断失败,请与网络管理人员联系"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | //================================================================================ |
| | | |
| | | //审核 |
| | | if (Cj_StationEntrustInBillCheckBill(HInterID, CurUserName, ref DBUtility.ClsPub.sExeReturnInfo)) |
| | | if (Cj_StationEntrustInBillCheckBill(HInterID, oBill.omodel.HBillNo, CurUserName, ref DBUtility.ClsPub.sExeReturnInfo)) |
| | | { |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | |
| | | } |
| | | |
| | | //审核 |
| | | public bool Cj_StationEntrustInBillCheckBill(Int64 lngBillKey, string CurUserName, ref string sReturn) |
| | | public bool Cj_StationEntrustInBillCheckBill(Int64 lngBillKey, string HBillNo, string CurUserName, ref string sReturn) |
| | | { |
| | | try |
| | | { |
| | |
| | | |
| | | oCN.RunProc(" Update Sc_StationInBillMain set HChecker='" + HChecker + "',HCheckDate='" + HCheckDate + "' Where HInterID=" + lngBillKey.ToString()); |
| | | oCN.RunProc("exec h_p_Mes_ProcessExchangeRelationQty_Check_In " + lngBillKey.ToString() + ",1"); |
| | | |
| | | |
| | | |
| | | //审核后控制================================================================================ |
| | | string sql = "exec h_p_Sc_StationInBill_WW_AfterCheckCtrl " + lngBillKey + ",'" + HBillNo + "','" + CurUserName + "'"; |
| | | ds = oCN.RunProcReturn(sql, "h_p_Sc_StationInBill_WW_AfterCheckCtrl"); |
| | | if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0) |
| | | { |
| | | sReturn = "审核过程中出错,请与网络管理人员联系"; |
| | | oCN.RollBack(); |
| | | return false; |
| | | } |
| | | if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0") |
| | | { |
| | | sReturn = ds.Tables[0].Rows[0]["HRemark"].ToString(); |
| | | oCN.RollBack(); |
| | | return false; |
| | | } |
| | | //================================================================================ |
| | | |
| | | sReturn = sReturn + " 审核功能!"; |
| | | oCN.Commit(); |
| | | return true; |
| | |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | //反审核前控制============================================================= |
| | | string sql = "exec h_p_Sc_StationInBill_WW_BeforeUnCheckCtrl " + HInterID + ",'" + oBill.omodel.HBillNo + "','" + CurUserName + "'"; |
| | | ds = oCN.RunProcReturn(sql, "h_p_Sc_StationInBill_WW_BeforeUnCheckCtrl"); |
| | | if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "反审核失败!原因:反审核前判断失败,请与网络管理人员联系"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | |
| | | } |
| | | if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "反审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | //================================================================================ |
| | | |
| | | //反审核 |
| | | if (Cj_StationEntrustInBillAbandonCheckBill(HInterID, CurUserName, ref DBUtility.ClsPub.sExeReturnInfo)) |
| | | if (Cj_StationEntrustInBillAbandonCheckBill(HInterID, oBill.omodel.HBillNo, CurUserName, ref DBUtility.ClsPub.sExeReturnInfo)) |
| | | { |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | |
| | | } |
| | | |
| | | //反审核 |
| | | public bool Cj_StationEntrustInBillAbandonCheckBill(Int64 lngBillKey, string CurUserName, ref string sReturn) |
| | | public bool Cj_StationEntrustInBillAbandonCheckBill(Int64 lngBillKey,string HBillNo, string CurUserName, ref string sReturn) |
| | | { |
| | | try |
| | | { |
| | |
| | | |
| | | oCN.RunProc(" Update Sc_StationInBillMain set HChecker='',HCheckDate=null Where HInterID=" + lngBillKey.ToString()); |
| | | //oCN.RunProc("exec h_p_Mes_ProcessExchangeRelationQty_Check_In " + lngBillKey.ToString() + ",-1"); |
| | | |
| | | |
| | | //反审核后控制============================================================================= |
| | | string sql = "exec h_p_Sc_StationInBill_WW_AfterUnCheckCtrl " + lngBillKey + ",'" + HBillNo + "','" + CurUserName + "'"; |
| | | ds = oCN.RunProcReturn(sql, "h_p_Sc_StationInBill_WW_AfterUnCheckCtrl"); |
| | | if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0) |
| | | { |
| | | sReturn = "反审核过程中出错,请与网络管理人员联系"; |
| | | oCN.RollBack(); |
| | | return false; |
| | | } |
| | | if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0") |
| | | { |
| | | sReturn = ds.Tables[0].Rows[0]["HRemark"].ToString(); |
| | | oCN.RollBack(); |
| | | return false; |
| | | } |
| | | //============================================================================= |
| | | sReturn = sReturn + "反审核功能!"; |
| | | oCN.Commit(); |
| | | return true; |
| | |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | var HBillNo = ds.Tables[0].Rows[0]["HBillNo"].ToString(); |
| | | //关闭前控制========================================= |
| | | string sql1 = "exec h_p_Sc_StationInBill_WW_BeforeCloseCtrl " + HInterID + ",'" + HBillNo + "','" + user + "'"; |
| | | ds = oCN.RunProcReturn(sql1, "h_p_Sc_StationInBill_WW_BeforeCloseCtrl"); |
| | | if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "关闭失败!原因:关闭前判断失败,请与网络管理人员联系"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "关闭失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | //================================================================================== |
| | | |
| | | //关闭单据 |
| | | if (!BillOld.CloseBill(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo)) |
| | | if (!BillOld.CloseBill(Int64.Parse(HInterID), HBillNo, "h_p_Sc_StationInBill_WW_AfterCloseCtrl", user, ref ClsPub.sExeReturnInfo)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | var HBillNo = ds.Tables[0].Rows[0]["HBillNo"].ToString(); |
| | | //反关闭前控制========================================= |
| | | string sql1 = "exec h_p_Sc_StationInBill_WW_BeforeUnCloseCtrl " + HInterID + ",'" + HBillNo + "','" + user + "'"; |
| | | ds = oCN.RunProcReturn(sql1, "h_p_Sc_StationInBill_WW_BeforeUnCloseCtrl"); |
| | | if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "反关闭失败!原因:反关闭前判断失败,请与网络管理人员联系"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "反关闭失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | //================================================================================== |
| | | |
| | | |
| | | //反关闭单据 |
| | | if (!BillOld.CancelClose(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo)) |
| | | if (!BillOld.CancelClose(Int64.Parse(HInterID), HBillNo, "h_p_Sc_StationInBill_WW_AfterUnCloseCtrl", user, ref ClsPub.sExeReturnInfo)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | |
| | | return objJsonResult; |
| | | } |
| | | |
| | | //删除前控制========================================= |
| | | string HBillNo = oBill.omodel.HBillNo; |
| | | string sql1 = "exec h_p_Sc_StationInBill_WW_BeforeDelCtrl " + HInterID + ",'" + HBillNo + "','" + HDeleteMan + "'"; |
| | | ds = oCN.RunProcReturn(sql1, "h_p_Sc_StationInBill_WW_BeforeDelCtrl"); |
| | | if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "删除失败!原因:删除前判断失败,请与网络管理人员联系"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "删除失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | //================================================================================== |
| | | |
| | | //写入删除日志 |
| | | string WorkList = "删除委外发出单:" + oBill.omodel.HBillNo; |
| | | if (!oBill.DeleteBill(oBill.omodel.HInterID, oBill.omodel.HProcExchInterID, oBill.omodel.HProcExchEntryID, ref DBUtility.ClsPub.sExeReturnInfo)) |
| | | if (!oBill.DeleteBill(oBill.omodel.HInterID, oBill.omodel.HProcExchInterID, oBill.omodel.HProcExchEntryID, HBillNo, "h_p_Sc_StationInBill_WW_AfterDelCtrl", HDeleteMan, ref DBUtility.ClsPub.sExeReturnInfo)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | |
| | | } |
| | | } |
| | | #endregion |
| | | // |
| | | // |
| | | } |
| | | } |