CLOUDWEB/WebService1.asmx.cs
@@ -2784,7 +2784,7 @@
            dal.oModel = oMain;
            if (!oBar.GetInfoByNumber_View(oMain.HBarCode))
            {
                sErrMsg = "无效条码";
                sErrMsg = "400-无效条码!";
                return false;
            }
            else
@@ -5172,11 +5172,25 @@
                        var result = client.Execute<string>("Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.Save",
                        new object[] { "STK_TransferDirect", sJson });
                        //保存时失败,就回滚
                        HReturn = result.ToString();
                        if (HReturn.Contains("\"IsSuccess\":false") == true)
                        {
                            sErrMsg = "生成直接调拨单失败!" + HReturn + sJson;
                            oCn.RollBack();
                            return false;
                        }
                        else
                        {
                            oCn.Commit();
                        }
                        //审核失败的话不回滚数据库 因为 已经存在单据
                        if (oSystemParameterMain.Kf_MoveStockBill_AutoCheck == "Y") //系统参数  自动审核 
                        {
                            string sJson2 = "{\"CreateOrgId\":0,\"Numbers\":[\"" + oMain.HBillNo + "\"]}";
                            var result2 = client.Execute<string>("Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.Submit",
                            new object[] { "STK_TransferDirect", sJson2 });
                            new object[] { "STK_TransferDirect", sJson2 });
                            string sJson3 = "{\"CreateOrgId\":0,\"Numbers\":[\"" + oMain.HBillNo + "\"]}";
                            var result3 = client.Execute<string>("Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.Audit",
@@ -5190,13 +5204,11 @@
                        }
                        if (HReturn.Contains("\"IsSuccess\":false") == true)
                        {
                            sErrMsg = "生成直接调拨单失败!" + HReturn + sJson;
                            oCn.RollBack();
                            sErrMsg = "自动审核直接调拨单失败!" + HReturn + sJson;
                            return false;
                        }
                        else
                        {
                            oCn.Commit();
                        {
                            return true;
                        }
                    }
@@ -6515,6 +6527,18 @@
                        var result = client.Execute<string>("Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.Save",
                        new object[] { "STK_TransferDirect", sJson });
                        HReturn = result.ToString();
                        if (HReturn.Contains("\"IsSuccess\":false") == true)
                        {
                            sErrMsg = "生成直接调拨单失败!" + HReturn + sJson;
                            oCn.RollBack();
                            return false;
                        }
                        else
                        {
                            oCn.Commit();
                        }
                        if (oSystemParameterMain.Kf_MoveStockBill_AutoCheck == "Y") //系统参数  自动审核 
                        {
                            string sJson2 = "{\"CreateOrgId\":0,\"Numbers\":[\"" + oMain.HBillNo + "\"]}";
@@ -6533,13 +6557,11 @@
                        }
                        if (HReturn.Contains("\"IsSuccess\":false") == true)
                        {
                            sErrMsg = "生成直接调拨单失败!" + HReturn + sJson;
                            oCn.RollBack();
                            sErrMsg = "自动审核直接调拨单失败!" + HReturn + sJson;
                            return false;
                        }
                        else
                        {
                            oCn.Commit();
                        {
                            return true;
                        }
                    }
@@ -10339,6 +10361,9 @@
                        var result = client.Execute<string>("Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.Save",
                        new object[] { "SAL_OUTSTOCK", sJson });
                        //生成单据后更新自定义字段
                        oCn.RunProc("exec h_p_Sc_UpDateSelfFildSellOut '" + oMain.HBillNo + "','" + sHSourceType + "'");
                        if (oSystemParameterMain.Kf_SellOutBill_AutoCheck == "Y") //系统参数  自动审核 
                        {
                            string sJson2 = "{\"CreateOrgId\":0,\"Numbers\":[\"" + oMain.HBillNo + "\"]}";
@@ -10661,6 +10686,9 @@
                    {
                        var result = client.Execute<string>("Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.Save",
                        new object[] { "SAL_OUTSTOCK", sJson });
                        //生成单据后更新自定义字段
                        oCn.RunProc("exec h_p_Sc_UpDateSelfFildSellOut '" + oMain.HBillNo + "','" + sHSourceType + "'");
                        if (oSystemParameterMain.Kf_SellOutBill_AutoCheck == "Y") //系统参数  自动审核 
                        {
@@ -10997,19 +11025,19 @@
                        {
                            if (oSystemParameterMain.WMS_CampanyName == "韩电")
                            {
                                //销售出库时反写发货通知单、销售订单
                                if (Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["F_XSLX"]) == "外销")
                                {
                                    //外销反写发货通知单、销售订单数量
                                    oCn.RunProc("EXEC h_p_ToCLD_BackDataDELIVERYNOTICE '" + oMain.HBillNo + "'");
                                }
                                else if (Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["F_XSLX"]) == "内销"
                                        || Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["F_XSLX"]) == "OEM"
                                        || Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["F_XSLX"]) == "电商")
                                {
                                    //内销、OEM和电商 关闭发货通知单、销售订单
                                    oCn.RunProc("EXEC h_p_ToCLD_BackDataDELIVERYNOTICE_Close '" + oMain.HBillNo + "'");
                                }
                                ////销售出库时反写发货通知单、销售订单
                                //if (Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["F_XSLX"]) == "外销")
                                //{
                                //    //外销反写发货通知单、销售订单数量
                                //    oCn.RunProc("EXEC h_p_ToCLD_BackDataDELIVERYNOTICE '" + oMain.HBillNo + "'");
                                //}
                                //else if (Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["F_XSLX"]) == "内销"
                                //        || Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["F_XSLX"]) == "OEM"
                                //        || Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["F_XSLX"]) == "电商")
                                //{
                                //    //内销、OEM和电商 关闭发货通知单、销售订单
                                //    oCn.RunProc("EXEC h_p_ToCLD_BackDataDELIVERYNOTICE_Close '" + oMain.HBillNo + "'");
                                //}
                            }
                            oCn.Commit();
                            return true;
@@ -15781,7 +15809,7 @@
            }
            if (oSystemParameter.omodel.Kf_POStockInBill_ERPMode.ToUpper() == "CLOUD")  //判断同步模式是金蝶CLOUD
            {
                if (oSystemParameter.omodel.WMS_CampanyName == "卓力" || oSystemParameter.omodel.WMS_CampanyName == "韩电" || oSystemParameter.omodel.WMS_CampanyName == "四维尔" || oSystemParameter.omodel.WMS_CampanyName == "雅琪诺") //系统参数  客户定制化名称     空白为通用
                if (oSystemParameter.omodel.WMS_CampanyName == "卓力" || oSystemParameter.omodel.WMS_CampanyName == "韩电" || oSystemParameter.omodel.WMS_CampanyName == "四维尔") //系统参数  客户定制化名称     空白为通用
                {
                    if (set_SavePOStockInBill_CLD(oMain, sHSourceType, oSystemParameter.omodel, ref sErrMsg) == true)
                    {
@@ -16265,6 +16293,8 @@
                            " \"FInStockEntry_Link_FRuleId\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FEntity_Link_FRuleId"]) + "\"," +
                            " \"FInStockEntry_Link_FSTableName\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FEntity_Link_FSTableName"]) + "\"," +
                            " \"FInStockEntry_Link_FSBillId\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FEntity_Link_FSBillId"]) + "\"," +
                            " \"FInStockEntry_Link_FBASEUNITQTYOLD\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FEntity_Link_FBASEUNITQTYOLD"]) + "\"," +
                            " \"FInStockEntry_Link_FREMAININSTOCKBASEQTYOLD\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FEntity_Link_FREMAININSTOCKBASEQTYOLD"]) + "\"," +
                            " \"FInStockEntry_Link_FSId\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FEntity_Link_FSId"]) + "\"" +
                        " } ]," +
                        " \"FBFLowId\":{\"FID\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FBFLowId"]) + "\"}}";
@@ -16301,6 +16331,9 @@
                    {
                        var result = client.Execute<string>("Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.Save",
                        new object[] { "STK_InStock", sJson });
                        //生成单据后更新自定义字段
                        oCn.RunProc("exec h_p_Sc_UpDateSelfFildPOStockIn '" + oMain.HBillNo + "','" + sHSourceType + "'");
                        if (oSystemParameterMain.Kf_POStockInBill_AutoCheck == "Y") //系统参数  自动审核 
                        {
@@ -19967,6 +20000,10 @@
                        var result = client.Execute<string>("Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.Save",
                        new object[] { "STK_InStock", sJson });
                        //生成单据后更新自定义字段
                        oCn.RunProc("exec h_p_Sc_UpDateSelfFildPOStockIn '" + oMain.HBillNo + "','" + sHSourceType + "'");
                        if (oSystemParameterMain.Kf_EntrustInBill_AutoCheck == "Y") //系统参数  自动审核 
                        {
                            string sJson2 = "{\"CreateOrgId\":0,\"Numbers\":[\"" + oMain.HBillNo + "\"]}";
@@ -22757,25 +22794,29 @@
            DAL.ClsGy_BarCodeBill_View dal = new DAL.ClsGy_BarCodeBill_View();
            if (dal.GetInfoByNumber_View(sBarCode))
            {
                sErrMsg = "";
                //-------------获取TMP中的原单主内码和子内码
                DataSet ds = oCN.RunProcReturn("exec h_p_WMS_GetBarCodeSourceInterID " + sInterID.ToString() + ",'" + sBarCode + "' ", "h_p_WMS_GetBarCodeSourceInterID");
                if(ds==null || ds.Tables[0].Rows.Count==0 )
                {
                //if (dal.omodel_View.HBarCodeType != "托盘条码")
                //{
                    sErrMsg = "";
                    //-------------获取TMP中的原单主内码和子内码
                    DataSet ds = oCN.RunProcReturn("exec h_p_WMS_GetBarCodeSourceInterID " + sInterID.ToString() + ",'" + sBarCode + "' ", "h_p_WMS_GetBarCodeSourceInterID");
                    if (ds == null || ds.Tables[0].Rows.Count == 0)
                    {
                }
                else
                {
                     if(DBUtility.ClsPub.isLong(ds.Tables[0].Rows[0][0])==0)
                     {
                         dal.omodel_View.HSourceBillNo = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HSourceBillNo"]);
                         dal.omodel_View.HSourceEntryID = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[0]["HSourceEntryID"]);
                         dal.omodel_View.HSourceInterID = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[0]["HSourceInterID"]);
                         dal.omodel_View.HinitQty = DBUtility.ClsPub.isDoule(ds.Tables[0].Rows[0]["HQtyMust"]);
                         sBool = true;
                     }
                }
                return dal.omodel_View;
                    }
                    else
                    {
                        if (DBUtility.ClsPub.isLong(ds.Tables[0].Rows[0][0]) == 0)
                        {
                            dal.omodel_View.HSourceBillNo = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HSourceBillNo"]);
                            dal.omodel_View.HSourceEntryID = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[0]["HSourceEntryID"]);
                            dal.omodel_View.HSourceInterID = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[0]["HSourceInterID"]);
                            dal.omodel_View.HinitQty = DBUtility.ClsPub.isDoule(ds.Tables[0].Rows[0]["HQtyMust"]);
                            sBool = true;
                        }
                    }
                    return dal.omodel_View;
                //}
            }
            else
            {
@@ -22912,6 +22953,14 @@
        {
            HInterID = DBUtility.ClsPub.CreateBillID_Prod(HTranType, ref sErrMsg);
            HBillNo = DBUtility.ClsPub.CreateBillCode_Prod(HTranType, ref sErrMsg, true);
            return true;
        }
        [WebMethod]
        //得到 最大单据ID
        public bool get_MaxBillID(string HTranType, ref Int64 HInterID, ref string sErrMsg)
        {
            HInterID = DBUtility.ClsPub.CreateBillID_Prod(HTranType, ref sErrMsg);
            return true;
        }
@@ -25788,64 +25837,72 @@
                    if (Dss == null || Dss.Tables[0].Rows.Count == 0)
                    {
                        //
                        //如果是销售出库并且是雅琪诺则托盘条码分解并模拟扫码
                        if (HBillType == "1205" && oSystemParameter.omodel.WMS_CampanyName == "雅琪诺")
                        DAL.ClsGy_BarCodeBill_View dal = new DAL.ClsGy_BarCodeBill_View();
                        if (dal.GetInfoByNumber_View(sBarCode))
                        {
                            //分解托条码得到明细条码信息写入出入库条码临时表
                            DataSet dsTBarCode;
                            string sBarCode_MX;
                            dsTBarCode = oCn.RunProcReturn("select b.HBarCode HBarCodeMX from Sc_PackUnionBillMain a  " +
                            " inner join Sc_PackUnionBillSub b on a.HInterID = b.HInterID " +
                            " Where a.HBarCode_Pack = '" + sBarCode + "'", "Sc_PackUnionBillMain");
                            if(dsTBarCode== null || dsTBarCode.Tables[0].Rows.Count==0)
                            //如果是销售出库并且是雅琪诺则托盘条码分解并模拟扫码
                            if (HBillType == "1205" && dal.omodel_View.HBarCodeType == "托盘条码" && oSystemParameter.omodel.WMS_CampanyName == "雅琪诺")
                            {
                                sErrMsg = "没有找到托盘条码!";
                                return null;
                                //分解托条码得到明细条码信息写入出入库条码临时表
                                DataSet dsTBarCode;
                                string sBarCode_MX;
                                dsTBarCode = oCn.RunProcReturn("select b.HBarCode HBarCodeMX from Sc_PackUnionBillMain a  " +
                                " inner join Sc_PackUnionBillSub b on a.HInterID = b.HInterID " +
                                " Where a.HBarCode_Pack = '" + sBarCode + "'", "Sc_PackUnionBillMain");
                                if (dsTBarCode == null || dsTBarCode.Tables[0].Rows.Count == 0)
                                {
                                    sErrMsg = "没有找到托盘条码!";
                                    return null;
                                }
                                else
                                {
                                    for (int i = 0; i < dsTBarCode.Tables[0].Rows.Count; i++)
                                    {
                                        sBarCode_MX = DBUtility.ClsPub.isStrNull(dsTBarCode.Tables[0].Rows[i]["HBarCodeMX"]);
                                        if (set_SavePonderationBillMain_Temp_BarCode(sBarCode_MX, HBillID, HBillType, HBillNo, HMaker, HWhID, HSPID, HQty, HRedBlueFlag, SourceFlag, HSourceBillNo, HSourceBillType, HOWNERID, HExpressNumber, ref sHSourceBillNo, ref sHSourceBillType, ref sHSupID, ref sHSupName, ref sHDeptID, ref sHDeptName, ref sErrMsg))
                                        {
                                            oBar.HSourceBillType = sHSourceBillType;
                                            oBar.HSourceBillNo = sHSourceBillNo;
                                            oBar.HSupID = sHSupID;
                                            oBar.HSupName = sHSupName;
                                            oBar.HDeptID = sHDeptID;
                                            oBar.HDeptName = sHDeptName;
                                        }
                                        else
                                        {
                                            sErrMsg = "单据号:" + HBillNo + ",单据ID:" + HBillID + ";扫描失败!" + sBarCode_MX + sErrMsg;
                                            //sErrMsg = "扫描失败!" + sErrMsg;
                                            return null;
                                        }
                                    }
                                    return oBar;
                                }
                            }
                            else
                            {
                                for(int i=0;i<dsTBarCode.Tables[0].Rows.Count;i++)
                                //将物料条码信息写入出入库条码临时表set_SavePonderationBillMain_Temp_BarCode
                                if (set_SavePonderationBillMain_Temp_BarCode(sBarCode, HBillID, HBillType, HBillNo, HMaker, HWhID, HSPID, HQty, HRedBlueFlag, SourceFlag, HSourceBillNo, HSourceBillType, HOWNERID, HExpressNumber, ref sHSourceBillNo, ref sHSourceBillType, ref sHSupID, ref sHSupName, ref sHDeptID, ref sHDeptName, ref sErrMsg))
                                {
                                    sBarCode_MX = DBUtility.ClsPub.isStrNull(dsTBarCode.Tables[0].Rows[i]["HBarCodeMX"]);
                                    if (set_SavePonderationBillMain_Temp_BarCode(sBarCode_MX, HBillID, HBillType, HBillNo, HMaker, HWhID, HSPID, HQty, HRedBlueFlag, SourceFlag, HSourceBillNo, HSourceBillType, HOWNERID, HExpressNumber, ref sHSourceBillNo, ref sHSourceBillType, ref sHSupID, ref sHSupName, ref sHDeptID, ref sHDeptName, ref sErrMsg))
                                    {
                                        oBar.HSourceBillType = sHSourceBillType;
                                        oBar.HSourceBillNo = sHSourceBillNo;
                                        oBar.HSupID = sHSupID;
                                        oBar.HSupName = sHSupName;
                                        oBar.HDeptID = sHDeptID;
                                        oBar.HDeptName = sHDeptName;
                                    }
                                    else
                                    {
                                        sErrMsg = "单据号:" + HBillNo + ",单据ID:" + HBillID + ";扫描失败!" + sBarCode_MX  + sErrMsg;
                                        //sErrMsg = "扫描失败!" + sErrMsg;
                                        return null;
                                    }
                                    oBar.HSourceBillType = sHSourceBillType;
                                    oBar.HSourceBillNo = sHSourceBillNo;
                                    oBar.HSupID = sHSupID;
                                    oBar.HSupName = sHSupName;
                                    oBar.HDeptID = sHDeptID;
                                    oBar.HDeptName = sHDeptName;
                                }
                                else
                                {
                                    sErrMsg = "单据号:" + HBillNo + ",单据ID:" + HBillID + ";扫描失败!" + sErrMsg;
                                    //sErrMsg = "扫描失败!" + sErrMsg;
                                    return null;
                                }
                                return oBar;
                            }
                        }
                        else
                        {
                            //将物料条码信息写入出入库条码临时表set_SavePonderationBillMain_Temp_BarCode
                            if (set_SavePonderationBillMain_Temp_BarCode(sBarCode, HBillID, HBillType, HBillNo, HMaker, HWhID, HSPID, HQty, HRedBlueFlag, SourceFlag, HSourceBillNo, HSourceBillType, HOWNERID, HExpressNumber, ref sHSourceBillNo, ref sHSourceBillType, ref sHSupID, ref sHSupName, ref sHDeptID, ref sHDeptName, ref sErrMsg))
                            {
                                oBar.HSourceBillType = sHSourceBillType;
                                oBar.HSourceBillNo = sHSourceBillNo;
                                oBar.HSupID = sHSupID;
                                oBar.HSupName = sHSupName;
                                oBar.HDeptID = sHDeptID;
                                oBar.HDeptName = sHDeptName;
                            }
                            else
                            {
                                sErrMsg = "单据号:" + HBillNo + ",单据ID:" + HBillID + ";扫描失败!" + sErrMsg;
                                //sErrMsg = "扫描失败!" + sErrMsg;
                                return null;
                            }
                            return oBar;
                        else
                        {
                            sErrMsg = "没有找到该条码!";
                            return null;
                        }
                    }
                    else