| | |
| | | { |
| | | try |
| | | { |
| | | List<object> a = new List<object>(); |
| | | foreach (DataColumn col in ds.Tables[0].Columns)//遍历ds中第一个表(Tables[0])的所有列(Columns)每次循环中,col变量会持有当前列的引用 |
| | | { |
| | | Type dataType = col.DataType; //获取当前数据类型传入 自定义变量datadataType |
| | | string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}"; //字符串拼接 // 将列名和数据类型信息拼接成一个JSON格式的字符串 |
| | | a.Add(JsonConvert.DeserializeObject(ColmString));//获取到DataColumn列对象的列名 |
| | | } |
| | | //if (ds.Tables[0].Rows.Count != 0 || ds != null) |
| | | //{ |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "Sucess!"; |
| | | objJsonResult.data = ds.Tables[0]; |
| | | objJsonResult.list = a; |
| | | |
| | | return objJsonResult; |
| | | //} |
| | | //else |
| | |
| | | { |
| | | try |
| | | { |
| | | LogService.Write("生产汇报单进入同步方法,汇报单号:" + BillNo); |
| | | |
| | | string sErr = ""; |
| | | oSystemParameter.ShowBill(ref sErr); |
| | | |
| | |
| | | DataSet ds = oCN.RunProcReturn("select * from h_v_MES_StationOutBillList_LastProc where HInterID=" + InterID, "h_v_MES_StationOutBillList_LastProc"); |
| | | if (ds.Tables[0].Rows.Count <= 0) |
| | | { |
| | | LogService.Write("生产汇报单回滚,汇报单号:" + BillNo + " 原因:生成生产汇报单过程中没有查询到出站单"); |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "生成生产汇报单过程中没有查询到出站单"; |
| | |
| | | |
| | | //保存 |
| | | oCN.BeginTran(); |
| | | DataSet DsTable = oCN.RunProcReturn($"select * from Sc_ICMOReportBillMain where HBillNo='{HBillNo}'", "Sc_ICMOReportBillMain"); |
| | | DataSet DsTable = oCN.RunProcReturn($"select * from Sc_ICMOReportBillMain with(nolock) where HBillNo='{HBillNo}'", "Sc_ICMOReportBillMain"); |
| | | if (DsTable.Tables[0].Rows.Count > 0) |
| | | { |
| | | LogService.Write("生产汇报单回滚,汇报单号:" + BillNo + " 原因:已入库,请不要重复入库"); |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "已入库,请不要重复入库"; |
| | |
| | | var isSuccess = JObject.Parse(loginRet)["LoginResultType"].Value<int>(); |
| | | if (isSuccess == 0) |
| | | { |
| | | LogService.Write("生产汇报单回滚,汇报单号:" + BillNo + " 原因:操作失败,金蝶账号登录异常"); |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "操作失败,金蝶账号登录异常。" + loginRet; |
| | |
| | | if (JObject.Parse(result)["Result"]["ResponseStatus"]["IsSuccess"].ToString().ToUpper() != "TRUE") |
| | | { |
| | | LogService.Write("工序汇报单入库错误jsonRoot:" + jsonRoot); |
| | | LogService.Write("生产汇报单保存失败,汇报单号:" + BillNo + " 原因:" + result); |
| | | oCN.RollBack(); |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | |
| | | result2 = InvokeHelper.Audit("PRD_MORPT", JsonConvert.SerializeObject(json));//提交 |
| | | if (JObject.Parse(result1)["Result"]["ResponseStatus"]["IsSuccess"].ToString().ToUpper() != "TRUE") |
| | | { |
| | | LogService.Write("生产汇报单提交失败,汇报单号:" + BillNo + " 原因:" + result1); |
| | | oCN.RollBack(); |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = $"生产汇报单单号:{fBillNo},提交失败" + result; |
| | | objJsonResult.Message = $"生产汇报单单号:{fBillNo},提交失败" + result1; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | |
| | | oCN.RunProc("update Sc_StationOutBillMain set HRelationQty=1 where HBillNo='" + BillNo + "'"); |
| | | |
| | | oCN.Commit(); |
| | | |
| | | LogService.Write("生产汇报单保存成功,汇报单号:" + BillNo ); |
| | | |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "保存成功!"; |
| | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | LogService.Write("生产汇报单同步发生异常,汇报单号:" + BillNo + " " + e.ToString()); |
| | | oCN.RollBack(); |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | |
| | | { |
| | | try |
| | | { |
| | | LogService.Write("生产入库单进入同步方法:" + " 入库单号:" + BillNo); |
| | | //获取生产汇报单最大InterID和单据号 |
| | | Int64 HInterID = DBUtility.ClsPub.CreateBillID("1202", ref DBUtility.ClsPub.sExeReturnInfo); |
| | | string HBillNo = DBUtility.ClsPub.CreateBillCode("1202", ref DBUtility.ClsPub.sExeReturnInfo, true); |
| | |
| | | //DataRow dr = ds.Tables[0].Rows[0]; |
| | | |
| | | //判断入库的合格数量是否为0 |
| | | var DTable = oCN.RunProcReturn("select * from Sc_StationOutBillMain where HBillNo='" + BillNo + "' ", "Sc_StationOutBillMain").Tables[0]; |
| | | var DTable = oCN.RunProcReturn("select * from Sc_StationOutBillMain with(nolock) where HBillNo='" + BillNo + "' ", "Sc_StationOutBillMain").Tables[0]; |
| | | |
| | | if (double.Parse(DTable.Rows[0]["HQty"].ToString()) == 0) |
| | | { |
| | | LogService.Write("同步金蝶生产生产入库单回滚--出站单号:" + BillNo + " 回滚原因:合格数量为0,不需要入库!"); |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 2; |
| | | objJsonResult.Message = "合格数量为0,不需要入库!"; |
| | |
| | | var isSuccess = JObject.Parse(loginRet)["LoginResultType"].Value<int>(); |
| | | if (isSuccess == 0) |
| | | { |
| | | LogService.Write("同步金蝶生产入库单回滚--出站单号:" + BillNo + " 回滚原因:操作失败,金蝶账号登录异常"); |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "操作失败,金蝶账号登录异常。" + loginRet; |
| | |
| | | |
| | | if (ds1 == null || ds1.Tables[0].Rows.Count == 0) |
| | | { |
| | | LogService.Write("同步金蝶生产入库单回滚--出站单号:" + BillNo + " 回滚原因:未找到对应的本地或金蝶云生产汇报单记录;1.未查询到对应的生产汇报单;2.请确保当前工序是末道工序3.汇报单对应的入库数量已满 请在金蝶云查看入库记录!"); |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "未找到对应的本地或金蝶云生产汇报单记录;1.未查询到对应的生产汇报单;2.请确保当前工序是末道工序3.汇报单对应的入库数量已满 请在金蝶云查看入库记录!"; |
| | |
| | | DataRow dr1 = ds1.Tables[0].Rows[0]; |
| | | if (double.Parse(dr1[0].ToString()) <= 0) |
| | | { |
| | | LogService.Write("同步金蝶生产入库单回滚--出站单号:" + BillNo + " 回滚原因:未找到对应的生产汇报单记录;1.未查询到对应的生产汇报单;2.请确保当前工序是末道工序3.汇报单对应的入库数量已满 请在金蝶云查看入库记录!"); |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "未找到对应的生产汇报单记录;1.未查询到对应的生产汇报单;2.请确保当前工序是末道工序3.汇报单对应的入库数量已满 请在金蝶云查看入库记录!"; |
| | |
| | | |
| | | if (ds.Tables[0].Rows.Count > 0) |
| | | { |
| | | LogService.Write("同步金蝶生产入库单回滚--出站单号:" + BillNo + " 回滚原因:当前出站单号已入库,请不要重新入库!"); |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "当前出站单号已入库,请不要重新入库!"; |
| | |
| | | } |
| | | |
| | | //判断金蝶云生产汇报单 数量 是否 大于 末道出站数量 |
| | | ds = oCN.RunProcReturn($@"select sum(FFinishQty)-sum(FSTOCKINQUASELQTY)-(select HQty from Sc_StationOutBillMain where HBillNo='{BillNo}') |
| | | ds = oCN.RunProcReturn($@"select sum(FFinishQty)-sum(FSTOCKINQUASELQTY)-(select HQty from Sc_StationOutBillMain with(nolock) where HBillNo='{BillNo}') |
| | | from AIS20220308151944..T_PRD_MORPT rpt3 |
| | | left join AIS20220308151944..T_PRD_MORPTENTRY rpt2 on rpt3.FID = rpt2.FID |
| | | left join AIS20220308151944..T_PRD_MORPTENTRY_A rpt1 on rpt2.FID = rpt1.FID |
| | |
| | | |
| | | if (double.Parse(ds.Tables[0].Rows[0][0].ToString()) < 0) |
| | | { |
| | | LogService.Write("同步金蝶生产入库单回滚--出站单号:" + BillNo + " 回滚原因:金蝶云汇报数量小于本地出站数量!"); |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "金蝶云汇报数量小于本地出站数量!"; |
| | |
| | | { |
| | | if (item["HWYID"].ToString() == null || item["HWYID"].ToString() == "" || item["HWYID"].ToString() == "undefined") |
| | | { |
| | | LogService.Write("同步金蝶生产入库单回滚--出站单号:" + BillNo + " 回滚原因:唯一ID为空,请重新手动入库或联系管理员!"); |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "唯一ID为空,请重新手动入库或联系管理员!"; |
| | |
| | | string result = InvokeHelper.Save("PRD_INSTOCK", JsonConvert.SerializeObject(jsonRoot));//保存 |
| | | //判断保存是否成功 |
| | | if (JObject.Parse(result)["Result"]["ResponseStatus"]["IsSuccess"].ToString().ToUpper() != "TRUE") |
| | | { |
| | | LogService.Write("生产入库错误jsonRoot:" + jsonRoot); |
| | | { |
| | | LogService.Write("生产入库保存错误jsonRoot:" + jsonRoot + " 入库单号:" + BillNo); |
| | | oCN.RollBack(); |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | |
| | | //result2 = InvokeHelper.Audit("PRD_INSTOCK", JsonConvert.SerializeObject(json));//提交 |
| | | if (JObject.Parse(result1)["Result"]["ResponseStatus"]["IsSuccess"].ToString().ToUpper() != "TRUE") |
| | | { |
| | | LogService.Write("生产入库提交错误jsonRoot:" + jsonRoot + " 入库单号:" + BillNo); |
| | | oCN.RollBack(); |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | |
| | | } |
| | | |
| | | oCN.RunProc("update Sc_StationOutBillMain set HRelationQty=1 where HBillNo='" + BillNo + "'"); |
| | | |
| | | LogService.Write("生产入库同步成功:" + " 入库单号:" + BillNo); |
| | | oCN.Commit(); |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | LogService.Write("生产入库同步发生异常:" + " 入库单号:" + BillNo + " " + e.ToString()); |
| | | oCN.RollBack(); |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | |
| | | DataSet ds; |
| | | try |
| | | { |
| | | |
| | | if (!DBUtility.ClsPub.Security_Log("Sc_ProcessPlan_Query", 1, false, user)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | |
| | | string sql = sql1 + sWhere + " order by hmainid desc "; |
| | | ds = oCN.RunProcReturn(sql, "h_v_Sc_ProcessPlanList"); |
| | | } |
| | | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | |
| | | } |
| | | #endregion |
| | | |
| | | #region 不良品评审处理单 出站单下推查询 |
| | | |
| | | [Route("Sc_ProcessMangement/Get_Sc_StationOutBill")] |
| | | [HttpGet] |
| | | public object Get_Sc_StationOutBill(string HID) |
| | | { |
| | | try |
| | | { |
| | | List<object> columnNameList = new List<object>(); |
| | | |
| | | string sql = "select * from h_v_MES_StationOutBillList where hmainid='" + HID + "'"; |
| | | ds = oCN.RunProcReturn(sql, "h_v_MES_StationOutBillList"); |
| | | |
| | | //添加列名 |
| | | 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 ex) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "查询数据异常,请与管理员联系!" + ex.ToString(); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | #endregion |
| | | |
| | | #region 不良品评审处理验收单 |