1
llj
2026-02-02 d447fe730ad8b7e6c3c31b3fdaab67e3bcf9fe5b
WebAPI/Controllers/CGGL/Cg_POOrderBillController.cs
@@ -800,40 +800,62 @@
        }
        [Route("Cg_POOrderBill/jindieCloud")]
        [HttpPost]
        public bool jindieCloud(int HSupID,int MaterID)
        public object jindieCloud(int HSupID,int MaterID)
        {
            Int64 HInterID = 0;
            string HBillNo = "";
            string sErrMsg = "";
            HInterID = DBUtility.ClsPub.CreateBillID_Prod("1102", ref sErrMsg);
            HBillNo = DBUtility.ClsPub.CreateBillCode_Prod("1102", ref sErrMsg, true);
            WebS.ClsCg_POOrderBillMain websLsmain = new WebS.ClsCg_POOrderBillMain();
            try
            {
                oCN.BeginTran();
                Int64 HInterID = 0;
                string HBillNo = "";
                string sErrMsg = "";
                HInterID = DBUtility.ClsPub.CreateBillID_Prod("1102", ref sErrMsg);
                HBillNo = DBUtility.ClsPub.CreateBillCode_Prod("1102", ref sErrMsg, true);
                WebS.ClsCg_POOrderBillMain websLsmain = new WebS.ClsCg_POOrderBillMain();
            
            websLsmain.HInterID = HInterID;
            websLsmain.HDate = DateTime.Now;
            websLsmain.HBillNo = HBillNo;
            websLsmain.HSupID = HSupID;
            websLsmain.HEmpID = MaterID;
            websLsmain.HSTOCKORGID = 100038;
            //websLsmain.HBillType = mainList[0].HBillType;
            if (!oWebs.set_Bill_New(websLsmain, "1100", ref DBUtility.ClsPub.sErrInfo))
            {
                objJsonResult.code = "0";
                websLsmain.HInterID = HInterID;
                websLsmain.HDate = DateTime.Now;
                websLsmain.HBillNo = HBillNo;
                websLsmain.HSupID = HSupID;
                websLsmain.HEmpID = MaterID;
                //websLsmain.HSTOCKORGID = 100038;
                //websLsmain.HBillType = mainList[0].HBillType;
                objJsonResult = AddBillMould(HBillNo, MaterID, HSupID);
                if (objJsonResult.code == "0")
                {
                    oCN.RollBack();
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = objJsonResult.Message;
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                if (!oWebs.set_Bill_New(websLsmain, "1100", ref DBUtility.ClsPub.sErrInfo))
                {
                    oCN.RollBack();
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "返回金蝶单据失败";  //成功!
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                oCN.Commit();
                objJsonResult.code = "1";
                objJsonResult.count = 1;
                objJsonResult.Message = "返回金蝶单据失败";  //成功!
                objJsonResult.Message = "提交成功";  //成功!
                objJsonResult.data = null;
                return false;
                return objJsonResult;
            }
            objJsonResult = AddBillMould(HBillNo, MaterID, HSupID);
            if (objJsonResult.code == "0")
            catch (Exception e)
            {
                oCN.RollBack();
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = objJsonResult.Message;
                objJsonResult.Message = "保存失败!" + e.ToString();
                objJsonResult.data = null;
                return false;
                return objJsonResult;
            }
            return true;
        }
        public json AddBillMould(string HBillNo,int MaterID,int HSupID)
        {
@@ -3574,7 +3596,70 @@
        }
        #endregion
        #region 采购订单编辑回显
        [Route("Cg_POOrderBill/QueryListEdit")]
        [HttpGet]
        public object QueryListEdit(string sWhere, string user)
        {
            try
            {
                List<object> columnNameList = new List<object>();
                //判断权限
                if (!DBUtility.ClsPub.Security_Log("Cg_POOrderBillList", 3, false, user))
                {
                    objJsonResult.code = CodeConstant.FAIL;
                    objJsonResult.count = CountConstant.FAIL;
                    objJsonResult.Message = "无查看权限!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                //if (!DBUtility.ClsPub.Security_Log("Sc_EmployeeSignInNoteBillMain_Query", 1, false, user))
                //{
                //    objJsonResult.code = "0";
                //    objJsonResult.count = 0;
                //    objJsonResult.Message = "无查看权限!";
                //    objJsonResult.data = null;
                //    return objJsonResult;
                //}
                if (sWhere == null || sWhere.Equals(""))
                {
                    ds = oCN.RunProcReturn("select * from h_v_Cg_POOrderBillEdit order by 单据号 desc", "h_v_Cg_POOrderBillEdit");
                }
                else
                {
                    string sql1 = "select * from  h_v_Cg_POOrderBillEdit  where 1 = 1 ";
                    string sql = sql1 + sWhere + " order by 单据号 desc";
                    ds = oCN.RunProcReturn(sql, "h_v_Cg_POOrderBillEdit");
                }
                //添加列名
                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
    }