duhe
2025-07-30 3a7dc098b5e662196e7bba93b425f3068f6fb082
WebAPI/Controllers/ÌõÂë¹ÜÀí/WEBSController.cs
@@ -3015,6 +3015,107 @@
        #endregion
        #region é”€å”®å‡ºåº“    æ–°å¢žæ¨¡å¼ï¼ˆæ ·å“é”€å”®å‡ºåº“)
        /// <summary>
        /// é”€å”®å‡ºåº“新增上传
        /// </summary>
        /// <returns></returns>
        [Route("WEBSController/set_SaveSellOutBill_Json_YP")]
        [HttpPost]
        public object set_SaveSellOutBill_Json_YP([FromBody] JObject oMain)
        {
            var _value = oMain["oMain"].ToString();
            string msg1 = _value.ToString();
            try
            {
                List<Model.ClsKf_SellOutBillMain> lsmain = new List<Model.ClsKf_SellOutBillMain>();
                ListModels oListModels = new ListModels();
                lsmain = oListModels.getSellOutBillMainByJson(msg1);
                WebS.ClsKf_SellOutBillMain websLsmain = new WebS.ClsKf_SellOutBillMain();
                string sSourceType = lsmain[0].HMainSourceBillType;
                websLsmain.HInterID = lsmain[0].HInterID;
                websLsmain.HBillNo = lsmain[0].HBillNo;
                websLsmain.HBillType = lsmain[0].HBillType;
                websLsmain.HDate = lsmain[0].HDate;
                websLsmain.HDeptID = lsmain[0].HDeptID;
                websLsmain.HWHID = lsmain[0].HWHID;
                websLsmain.HSCWHID = lsmain[0].HSCWHID;
                websLsmain.HSupID = lsmain[0].HSupID;
                websLsmain.HKeeperID = lsmain[0].HKeeperID;
                websLsmain.HSecManagerID = lsmain[0].HSecManagerID;
                websLsmain.HEmpID = lsmain[0].HEmpID;
                websLsmain.HManagerID = lsmain[0].HManagerID;
                websLsmain.HRemark = lsmain[0].HRemark;
                websLsmain.HExplanation = lsmain[0].HExplanation;
                websLsmain.HInnerBillNo = lsmain[0].HInnerBillNo;
                websLsmain.HRedBlueFlag = lsmain[0].HRedBlueFlag;
                websLsmain.HBillSubType = lsmain[0].HBillSubType;
                if (lsmain[0].HMainSourceBillType == "1402")
                {
                    websLsmain.HMainSourceBillType = "发货通知单";
                }
                else if (lsmain[0].HMainSourceBillType == "1401")
                {
                    websLsmain.HMainSourceBillType = "销售订单";
                }
                else
                {
                    websLsmain.HMainSourceBillType = "手工录入";
                }
                websLsmain.HMaker = lsmain[0].HMaker;
                websLsmain.HBillerID = lsmain[0].HBillerID;
                websLsmain.HSTOCKORGID = lsmain[0].HSTOCKORGID;
                websLsmain.HOWNERID = lsmain[0].HSTOCKORGID;
                if (oWebs.set_SaveSellOutBill_New(websLsmain, sSourceType, ref DBUtility.ClsPub.sErrInfo))
                {
                    if(lsmain[0].HIsTaxRate == 1)
                    {
                        try
                        {
                            oCn.BeginTran();
                            string sql_reWriteTaxData = "exec h_p_Kf_SellOutBill_withOutSourceBill_ReWriteTax " + lsmain[0].HInterID;
                            oCn.RunProc(sql_reWriteTaxData);
                            oCn.Commit();
                        }
                        catch (Exception e3)
                        {
                            oCn.RollBack();
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "销售出库单上传成功!!税率计算失败!!" + e3.ToString();
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                    }
                    objJsonResult.code = "0";
                    objJsonResult.count = 1;
                    objJsonResult.Message = DBUtility.ClsPub.sErrInfo;  //成功!
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                else
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = DBUtility.ClsPub.sErrInfo;  //失败!
                    objJsonResult.data = null;
                    return objJsonResult;
                }
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "销售出库单上传失败!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
        #region é”€å”®å‡ºåº“    æ ¡éªŒæ¨¡å¼
        /// <summary>