chenhaozhe
1 天以前 14ae0e21c8660dbb3ac20a5b0d9db9b6dde3cfb9
WebAPI/Controllers/CJGL/Cj_StationEntrustOutBillController.cs
@@ -885,25 +885,25 @@
                }
                //审核前控制================================================================================
                //string sql = "exec h_p_StationEntrustOutBill_WW_BeforeCheckCtrl " + HInterID + ",'" + oBill.omodel.HBillNo + "','" + CurUserName + "'";
                //ds = oCN.RunProcReturn(sql, "h_p_StationEntrustOutBill_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;
                //}
                string sql = "exec h_p_StationEntrustOutBill_WW_BeforeCheckCtrl " + HInterID + ",'" + oBill.omodel.HBillNo + "','" + CurUserName + "'";
                ds = oCN.RunProcReturn(sql, "h_p_StationEntrustOutBill_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 (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;
                }
                //================================================================================
                //审核
@@ -965,20 +965,20 @@
                }
                //审核后控制================================================================================
                //string sql = "exec h_p_StationEntrustOutBill_WW_AfterCheckCtrl " + lngBillKey + ",'" + HBillNo + "','" + CurUserName + "'";
                //ds = oCN.RunProcReturn(sql, "h_p_StationEntrustOutBill_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;
                //}
                string sql = "exec h_p_StationEntrustOutBill_WW_AfterCheckCtrl " + lngBillKey + ",'" + HBillNo + "','" + CurUserName + "'";
                ds = oCN.RunProcReturn(sql, "h_p_StationEntrustOutBill_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;
                }
                //================================================================================
@@ -1380,6 +1380,7 @@
        }
        #endregion
        //审核,带编辑功能
        [Route("Cj_StationEntrustOutBill/setOtherProperty")]
        [HttpPost]
        public object setOtherProperty([FromBody] JObject oMain)
@@ -1392,15 +1393,23 @@
                string msg2 = "[" + sArray[0].ToString() + "]";
                string user = sArray[1].ToString();
                ////判断是否有编辑权限
                //if (!DBUtility.ClsPub.Security_Log("MES_StationEntrustOutBill_Edit", 1, false, user))
                //{
                //    objJsonResult.code = "0";
                //    objJsonResult.count = 0;
                //    objJsonResult.Message = "无编辑权限!";
                //    objJsonResult.data = null;
                //    return objJsonResult;
                //}
                if (!DBUtility.ClsPub.Security_Log("MES_StationEntrustOutBill_Edit", 1, false, user))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "无编辑权限!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                //审核权限
                if (!DBUtility.ClsPub.Security_Log("MES_StationEntrustOutBill_Check", 1, false, user))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "审核失败!无权限!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                List<StationBill> list1 = Newtonsoft.Json.JsonConvert.DeserializeObject<List<StationBill>>(msg2);
                long HInterID = list1[0].HInterID;
                double HQty= list1[0].HQty;
@@ -1412,33 +1421,91 @@
                long HGroupID = list1[0].HGroupID;
                long HEmpID = list1[0].HEmpID;
                oCN.BeginTran();
                DataSet ds = oCN.RunProcReturn("select * from Sc_StationOutBillMain where HInterID="+ HInterID, "Sc_StationOutBillMain");
                if(ds.Tables.Count>0)
                if(ds.Tables.Count>0 && ds.Tables[0].Rows[0]["HChecker"].ToString()=="")
                {
                    if(HQty>0)
                    string HBillNo = ds.Tables[0].Rows[0]["HBillNo"].ToString();
                    int HProcExchInterID = int.Parse(ds.Tables[0].Rows[0]["HProcExchInterID"].ToString());
                    int HProcExchEntryID = int.Parse(ds.Tables[0].Rows[0]["HProcExchEntryID"].ToString());
                    int HProcNo = int.Parse(ds.Tables[0].Rows[0]["HProcNo"].ToString());
                    //审核前控制================================================================================
                    string sql = "exec h_p_StationEntrustOutBill_WW_BeforeCheckCtrl " + HInterID + ",'" + HBillNo + "','" + user + "'";
                    ds = oCN.RunProcReturn(sql, "h_p_StationEntrustOutBill_WW_BeforeCheckCtrl");
                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                    {
                        oCN.BeginTran();
                        oCN.RunProc($"update Sc_StationOutBillMain set HQty={HQty},HBadCount='{HBadCount}',HWasterQty='{HWasterQty}',HSourceID='{HSourceID}',HCenterID='{HCenterID}',HGroupID={HGroupID},HEmpID={HEmpID} where HInterID={HInterID} ");
                        oCN.Commit();
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "审核失败!原因:审核前判断失败,请与网络管理人员联系";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    set_CheckBill(Convert.ToInt32(HInterID) , user);
                    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 (HQty>0)
                    {
                        oCN.RunProc($"update Sc_StationOutBillMain set HBillStatus = 2,HQty={HQty},HBadCount='{HBadCount}',HWasterQty='{HWasterQty}',HSourceID='{HSourceID}',HCenterID='{HCenterID}',HGroupID={HGroupID},HEmpID={HEmpID},HChecker='{user}',HCheckDate=getdate() where HInterID={HInterID} ");
                    }
                    string sReturn = "";
                    //获取系统参数
                    oSystemParameter.ShowBill(ref sReturn);
                    //判断客户为天擎 同步金蝶工序汇报单
                    if (oSystemParameter.omodel.WMS_CampanyName == "天擎")
                    {
                        if (set_SaveStationEntrustOutBill_CLD(HBillNo, HProcExchInterID, HProcExchEntryID, HProcNo, HQty, user, ref DBUtility.ClsPub.sErrInfo))
                        {
                            oCN.Commit();
                            objJsonResult.code = "0";
                            objJsonResult.count = 1;
                            objJsonResult.Message = DBUtility.ClsPub.sErrInfo;  //成功!
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                        else
                        {
                            oCN.RollBack();
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = DBUtility.ClsPub.sErrInfo;  //失败!
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                    }
                    oCN.Commit();
                    objJsonResult.code = "1";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "审核成功!";
                    objJsonResult.Message = "审核修改成功!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                else
                {
                    oCN.Commit();
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "单据不存在!";
                    objJsonResult.Message = "单据不存在或已审核!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
            }
            catch (Exception e)
            {
@@ -1489,7 +1556,7 @@
            try
            {
                //返回API递入所需数据
                DataSet Ds = oCn.RunProcReturn("exec h_p_MES_StationEntrustOutBill_ProdMateRequest_CLD " + HProcExchInterID.ToString() + "," + HProcExchEntryID.ToString() + "," + HProcNo.ToString() + "," + HQty.ToString(), "h_p_MES_StationEntrustOutBill_ProdMateRequest_CLD");
                DataSet Ds = oCn.RunProcReturn("exec h_p_MES_StationEntrustOutBill_ProdMateRequest_CLD '" + HBillNo + "'," + HProcExchInterID.ToString() + "," + HProcExchEntryID.ToString() + "," + HProcNo.ToString() + "," + HQty.ToString(), "h_p_MES_StationEntrustOutBill_ProdMateRequest_CLD");
                if (Ds == null || Ds.Tables[0].Rows.Count == 0)
                {
                    sErrMsg = "未获取到API所需递入数据!";
@@ -1588,11 +1655,11 @@
                "\"FInOperDescr\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FInOperDescr"]) + "\"," +
                "\"FOutIsOutSrc\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FOutIsOutSrc"]) + "\"," +
                "\"FInSeqNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FInSeqNumber"]) + "\"," +
                //"\"FInPurOrgId\":{ \"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FInPurOrgId"]) + "\" }," +
                "\"FInPurOrgId\":{ \"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FInPurOrgId"]) + "\" }," +
                "\"FInOperNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FInOperNumber"]) + "\"," +
                "\"FInWorkCenterId\":{ \"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FInWorkCenterId"]) + "\" }," +
                //"FInEmpId": {"FSTAFFNUMBER": ""},
                //"\"FInSupplier\":{ \"FNAME\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FInSupplier"]) + "\" }," +
                "\"FInSupplier\":{ \"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FInSupplier"]) + "\" }," +
                "\"FOperApplyQty\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FOperApplyQty"]) + "\"," +
                "\"FTransferQty\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FTransferQty"]) + "\"," +
                "\"FApplyQty\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FApplyQty"]) + "\"," +
@@ -1613,22 +1680,22 @@
                //"FPreReworkQty": 0,
                //"FMatFailQty": 0,
                //"FValMatFailQty": 0,
                //"\"FSendCurrency\":{ \"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FSendCurrency"]) + "\" }," +
                "\"FSendCurrency\":{ \"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FSendCurrency"]) + "\" }," +
                "\"FIsInspect\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FIsInspect"]) + "\"," +
                "\"FQCSchemeId\":{ \"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FQCSchemeId"]) + "\" }," +
                //"\"FSendProFailPrice\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FSendProFailPrice"]) + "\"," +
                "\"FSendProFailPrice\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FSendProFailPrice"]) + "\"," +
                "\"FReceiveCurrency\":{ \"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FReceiveCurrency"]) + "\" }," +
                "\"FReceiveQualifiedPrice\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FReceiveQualifiedPrice"]) + "\"," +
                "\"FReceiveProFailPrice\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FReceiveProFailPrice"]) + "\"," +
                "\"FReceiveMatFailPrice\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FReceiveMatFailPrice"]) + "\"," +
                "\"FReceiveValuationUnitId\":{ \"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FReceiveValuationUnitId"]) + "\" }," +
                "\"FReceiveTaxRate\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FReceiveTaxRate"]) + "\"," +
                //"\"FSendMatFailPrice\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FSendMatFailPrice"]) + "\"," +
                "\"FSendMatFailPrice\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FSendMatFailPrice"]) + "\"," +
                //"FOperInspectSelectQty": 0,
                "\"FSendValuationUnitId\":{ \"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FSendValuationUnitId"]) + "\" }," +
                //"FInspectSelectQty": 0,
                //"\"FSendTaxRate\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FSendTaxRate"]) + "\"," +
                //"\"FSendQualifiedPrice\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FSendQualifiedPrice"]) + "\"," +
                "\"FSendTaxRate\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FSendTaxRate"]) + "\"," +
                "\"FSendQualifiedPrice\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FSendQualifiedPrice"]) + "\"," +
                //"FOperQuaSettleSelQty": 0,
                //"FValQuaSettleSelQty": 0,
                //"FQuaSettleSelQty": 0,
@@ -1683,9 +1750,9 @@
                "\"FReceiveQualifiedTaxPrice\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FReceiveQualifiedTaxPrice"]) + "\"," +
                "\"FReceiveProFailTaxPrice\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FReceiveProFailTaxPrice"]) + "\"," +
                "\"FReceiveMatFailTaxPrice\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FReceiveMatFailTaxPrice"]) + "\"," +
                //"\"FSendQualifiedTaxPrice\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FSendQualifiedTaxPrice"]) + "\"," +
                //"\"FSendProFailTaxPrice\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FSendProFailTaxPrice"]) + "\"," +
                //"\"FSendMatFailTaxPrice\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FSendMatFailTaxPrice"]) + "\"," +
                "\"FSendQualifiedTaxPrice\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FSendQualifiedTaxPrice"]) + "\"," +
                "\"FSendProFailTaxPrice\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FSendProFailTaxPrice"]) + "\"," +
                "\"FSendMatFailTaxPrice\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FSendMatFailTaxPrice"]) + "\"," +
                "\"FRateOperQty\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FRateOperQty"]) + "\"," +
                "\"FRateProQty\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FRateProQty"]) + "\"," +
                "\"FRateValQty\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FRateValQty"]) + "\"," +