基础资料,保存/审核送货单凯贝奈特新增判断,excel导入送货单查询语句修改,
New file |
| | |
| | | using DBUtility; |
| | | using Newtonsoft.Json; |
| | | using Newtonsoft.Json.Linq; |
| | | using SQLHelper; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Data; |
| | | using System.IO; |
| | | using System.Linq; |
| | | using System.Net; |
| | | using System.Net.Http; |
| | | using System.Web; |
| | | using System.Web.Http; |
| | | using WebAPI.Code; |
| | | using WebAPI.Models; |
| | | namespace WebAPI.Controllers |
| | | { |
| | | public class BasicInfoController : ApiController |
| | | { |
| | | |
| | | private json objJsonResult = new json(); |
| | | SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); |
| | | DataSet ds; |
| | | |
| | | /// <summary> |
| | | /// 返回货币列表 |
| | | ///参数:string sql。 |
| | | ///返回值:object。 |
| | | /// </summary> |
| | | [Route("Gy_Currency/list1")] |
| | | [HttpGet] |
| | | public object list(string sWhere, string user) |
| | | { |
| | | try |
| | | { |
| | | List<object> columnNameList = new List<object>(); |
| | | |
| | | if (sWhere == null || sWhere.Equals("")) |
| | | { |
| | | ds = oCN.RunProcReturn("select * from h_v_Gy_CurrencyList where 禁用标记=''" + sWhere + " order by 货币代码", "h_v_Gy_CurrencyList"); |
| | | } |
| | | else |
| | | { |
| | | string sql1 = "select * from h_v_Gy_CurrencyList where 禁用标记='' "; |
| | | string sql = sql1 + sWhere + " order by 货币代码"; |
| | | ds = oCN.RunProcReturn(sql, "h_v_Gy_CurrencyList"); |
| | | } |
| | | |
| | | |
| | | //添加列名 |
| | | 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 e) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "Exception!" + e.ToString(); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 获取物料列表 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | [Route("Web/GetMaterialList_Json")] |
| | | [HttpGet] |
| | | public object GetMaterialList_Json(string sWhere) |
| | | { |
| | | try |
| | | { |
| | | List<object> columnNameList = new List<object>(); |
| | | |
| | | if (sWhere == null || sWhere.Equals("")) |
| | | { |
| | | ds = oCN.RunProcReturn("select * from h_v_IF_Material " + sWhere + " order by HNumber", "h_v_IF_Material"); |
| | | } |
| | | else |
| | | { |
| | | string sql1 = "select * from h_v_IF_Material "; |
| | | string sql = sql1 + sWhere + " order by HNumber"; |
| | | ds = oCN.RunProcReturn(sql, "h_v_IF_Material"); |
| | | } |
| | | |
| | | |
| | | //添加列名 |
| | | 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; |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 返回供应商列表 |
| | | ///参数:string sql。 |
| | | ///返回值:object。 |
| | | /// </summary> |
| | | [Route("Gy_Supplier/list")] |
| | | [HttpGet] |
| | | public object list(string sWhere, string user, string Organization) |
| | | { |
| | | try |
| | | { |
| | | List<object> columnNameList = new List<object>(); |
| | | |
| | | string sql1 = string.Format(@"select * from h_v_Gy_SupplierList where 组织名称='" + Organization + "'"); |
| | | if (sWhere == null || sWhere.Equals("")) |
| | | { |
| | | ds = oCN.RunProcReturn(sql1 + sWhere + " order by 供应商代码", "h_v_Gy_SupplierList"); |
| | | } |
| | | else |
| | | { |
| | | string sql = sql1 + sWhere + " order by 供应商代码 "; |
| | | ds = oCN.RunProcReturn(sql, "h_v_Gy_SupplierList"); |
| | | } |
| | | |
| | | //添加列名 |
| | | 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 e) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "Exception!" + e.ToString(); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 获取单位列表 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | [Route("Web/GetUnitList_Json")] |
| | | [HttpGet] |
| | | public object GetUnitList_Json(string Unit) |
| | | { |
| | | string sWhere = ""; |
| | | |
| | | if (Unit != "") |
| | | { |
| | | sWhere = sWhere + " and ( HNumber like '%" + Unit + "%' or HName like '%" + Unit + "%' ) "; |
| | | } |
| | | try |
| | | { |
| | | SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); |
| | | if (sWhere == null || sWhere.Equals("")) |
| | | { |
| | | ds = oCN.RunProcReturn("Select HItemID,HNumber ,HName from Gy_Unit where HStopflag=0 Order by HItemID ", "Gy_Unit"); |
| | | } |
| | | else |
| | | { |
| | | string sql1 = "Select HItemID,HNumber ,HName from Gy_Unit where HStopflag=0 and HEndFlag=1 "; |
| | | string sql = sql1 + sWhere; |
| | | ds = oCN.RunProcReturn(sql, "Gy_Unit"); |
| | | } |
| | | |
| | | if (ds == null || ds.Tables[0].Rows.Count <= 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "获取失败" + DBUtility.ClsPub.sErrInfo; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | else |
| | | { |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "获取成功!"; |
| | | objJsonResult.data = ds.Tables[0]; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "获取失败" + ex.ToString(); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | |
| | | } |
| | | } |
| | |
| | | using System.Linq; |
| | | using System.Net; |
| | | using System.Net.Http; |
| | | using System.Text.RegularExpressions; |
| | | using System.Web; |
| | | using System.Web.Http; |
| | | using WebAPI.Code; |
| | |
| | | int i = 0; |
| | | foreach (Model.ClsCg_POInStockBillSub oItemSub in ls) |
| | | { |
| | | //判断采购订单状态 |
| | | objJsonResult = TestPOOrder(oItemSub.HPOOrderEntryID.ToString()); |
| | | if (FCusName.Contains("凯贝奈特")) //系统参数 客户定制化名称 空白为通用 |
| | | { |
| | | if (oItemSub.HBatChNo.Length < 8 || Regex.IsMatch(oItemSub.HBatChNo, @"^[0-9]+$") == false) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "保存失败!第" + i.ToString() + "行 生产日期D/C 格式错误无法保存!正确格式为8位数的纯数字日期"; |
| | | objJsonResult.data = 1; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | //获取年月日 |
| | | string year = oItemSub.HBatChNo.Substring(0, 4); |
| | | string month = oItemSub.HBatChNo.Substring(4, 2); |
| | | string day = oItemSub.HBatChNo.Substring(6, 2); |
| | | |
| | | //验证合法性 |
| | | if (Convert.ToInt32(year) < 1900 || Convert.ToInt32(year) > 2100) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "保存失败!第" + i.ToString() + "行 生产日期D/C 日期不合法无法保存!正确格式为8位数的纯数字日期"; |
| | | objJsonResult.data = 1; |
| | | return objJsonResult; |
| | | } |
| | | if (Convert.ToInt32(month) > 12 || Convert.ToInt32(day) > 31) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "保存失败!第" + i.ToString() + "行 生产日期D/C 日期不合法无法保存!"; |
| | | objJsonResult.data = 1; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | } |
| | | //判断采购订单状态 |
| | | objJsonResult = TestPOOrder(oItemSub.HPOOrderEntryID.ToString()); |
| | | if (objJsonResult.code == "0") |
| | | return objJsonResult; |
| | | //增加判断 送货数量超出采购订单数量 |
| | |
| | | ,D.FSUPPLIERID,DS.FNUMBER AS FSUPPLIERNUMBER,D.FPURCHASEORGID,DOO.FNUMBER AS FPURCHASEORGNUMBER,CROO.FNUMBER AS FSETTLEORGNUMBER, |
| | | E.FPRICETIMEPOINT,E.FSETTLECURRID,EC.FNUMBER AS FSETTLECURRNUMBER,C.FMATERIALID,CM.FNUMBER AS FMATERIALNUMBER ,C.FUNITID |
| | | ,CU.FNUMBER AS FUNITNUMBER,CR.FPRICE,CR.FTAXPRICE,CR.FTAXRATE,D.FPURCHASERID,isnull(T4.FNUMBER,'') AS FPURCHASERNUMBER |
| | | ,B.HExpressNumberSub,B.HExpressSupplierSub,B.HRemark,B.HPlanArrivalDate,B.HBoxNumber |
| | | ,B.HExpressNumberSub,B.HExpressSupplierSub,B.HRemark,B.HPlanArrivalDate,B.HBoxNumber,B.HBatChNo,D.FBILLTYPEID |
| | | FROM CG_POINSTOCKBILLSUB B |
| | | JOIN CG_POINSTOCKBILLMAIN M ON B.HINTERID = M.HINTERID |
| | | JOIN {0}..T_PUR_POORDERENTRY C ON B.HSOURCEINTERID = C.FID AND B.HSOURCEENTRYID = C.FENTRYID |
| | |
| | | fTypeName = "SLD04_SYS"; |
| | | ywTypeName = "ZCCG"; |
| | | } |
| | | if (FCusName == "凯贝奈特") |
| | | { |
| | | //1厂 |
| | | if (dr["FBILLTYPEID"].ToString() == "60cfe60fa16dd8") |
| | | { |
| | | fTypeName = "SLD08_SYS"; |
| | | } |
| | | //2厂 |
| | | if (dr["FBILLTYPEID"].ToString() == "60cfe634a1708f") |
| | | { |
| | | fTypeName = "SLD09_SYS"; |
| | | } |
| | | //3厂 |
| | | if (dr["FBILLTYPEID"].ToString() == "83d822ca3e374b4ab01e5dd46a0062bd") |
| | | { |
| | | fTypeName = "SLD01_SYS"; |
| | | } |
| | | } |
| | | model.Add("FBILLTYPEID", new JObject() { ["Fnumber"] = fTypeName }); //单据类型 |
| | | model.Add("FBusinessType", ywTypeName); //业务类型 |
| | | model.Add("FBILLNO", dr["HBillNo"].ToString()); //单据编号 |
| | |
| | | FentityModel.Add("FPrice", item["FPRICE"].ToString());//单价 |
| | | FentityModel.Add("FTaxPrice", item["FTAXPRICE"].ToString());//含税单价 |
| | | FentityModel.Add("FEntryTaxRate", item["FTAXRATE"].ToString());//税率 |
| | | FentityModel.Add("FLot", new JObject() { ["Fnumber"] = item["HBatChNo"].ToString() }); // 批号 |
| | | |
| | | FentityModel.Add("F_bsv_Text1", item["HExpressSupplierSub"].ToString());//物流单位 (瑞琪) |
| | | FentityModel.Add("F_bsv_Text2", item["HExpressNumberSub"].ToString());//物流单号 (瑞琪) |
| | |
| | | } |
| | | |
| | | //判断未关联数量是否为0 |
| | | //安瑞:AIS20220914133941 瑞与琪:AIS20220308151944 本地:AIS20210811135644 夏宝:AIS20211130140219 |
| | | DataSet ds = oCn.RunProcReturn($"select T1.hqty-T1.hrelationqty+q.FMRBQTY as hqty,单据号,物料编码 from H_v_SRM_POOrderBillList t1 left join AIS20210811135644..T_PUR_POORDERENTRY_R q on q.FENTRYID=t1.HEntryID where hentryid in ({string.Join(", ", entryList)}) ", "H_v_SRM_POOrderBillList"); |
| | | //安瑞:AIS20220914133941 瑞与琪:AIS20220308151944 本地:AIS20210811135644 夏宝:AIS20211130140219 凯贝:AIS20210820164804 |
| | | DataSet ds = oCn.RunProcReturn($"select T1.hqty-T1.hrelationqty+q.FMRBQTY as hqty,单据号,物料编码 from H_v_SRM_POOrderBillList t1 left join AIS20210820164804..T_PUR_POORDERENTRY_R q on q.FENTRYID=t1.HEntryID where hentryid in ({string.Join(", ", entryList)}) ", "H_v_SRM_POOrderBillList"); |
| | | DataTable dt = ds.Tables[0]; |
| | | if (dt.Rows.Count > 0) |
| | | { |
| | |
| | | DataTable dt = new DataTable(); |
| | | try |
| | | { |
| | | ds = oCn.RunProcReturn("select * from POOrderBill_Excel ", "POOrderBill_Excel"); |
| | | ds = oCn.RunProcReturn("select HORGName,SupplierName,MaterialNum,HPackFlag,sum(HQty) HQty from POOrderBill_Excel group by HORGName, SupplierName, MaterialNum, HPackFlag ", "POOrderBill_Excel"); |
| | | |
| | | for (int i = 0; i < ds.Tables[0].Rows.Count; i++) |
| | | { |
| | |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | |
| | | [Route("Cg_Poorder/UpdateSupSendGoodsDateRemark")] |
| | | [HttpGet] |
| | | /// <summary> |
| | | /// 更新回复交期 -- 凯贝奈特 |
| | | /// </summary> |
| | | /// <param name=""></param> |
| | | /// <returns></returns> |
| | | public object UpdateSupSendGoodsDateRemark(string HInterID, string HEntryID,string HSupSendGoodsDateRemark) |
| | | { |
| | | try |
| | | { |
| | | if (HInterID == null || HInterID == "" || HInterID == "undefined" || HEntryID == null || HEntryID == "" || HEntryID == "undefined") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "操作失败!主内码或子内码为空"; |
| | | objJsonResult.data = 1; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | string sql = ""; |
| | | |
| | | sql = "update Cg_POOrderBillSub set HSupSendGoodsDateRemark = '" + HSupSendGoodsDateRemark + "' where HInterID = " + HInterID + " and HEntryID = " + HEntryID; |
| | | oCn.RunProc(sql); |
| | | |
| | | //凯贝奈特 |
| | | sql = "update AIS20210820164804..T_PUR_POORDERENTRY set F_aaaa_Date1 = '" + HSupSendGoodsDateRemark + "' where FID = " + HInterID + " and FENTRYID = " + HEntryID; |
| | | oCn.RunProc(sql); |
| | | |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "操作成功!"; |
| | | objJsonResult.data = 1; |
| | | return objJsonResult; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "失败!" + e.ToString(); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | |
| | | } |
| | | } |
| | |
| | | } |
| | | #endregion |
| | | |
| | | |
| | | #region 供应商报价单 保存/编辑 |
| | | /// <summary> |
| | | /// 供应商报价单 保存 |
| | | /// </summary> |
| | | /// <param name="msg"></param> |
| | | /// <returns></returns> |
| | | [Route("Sup_QuotePriceBill/SaveQuotePriceBill")] |
| | | [HttpPost] |
| | | public object SaveQuotePriceBill([FromBody] JObject msg) |
| | | { |
| | | var _value = msg["msg"].ToString(); |
| | | string msg1 = _value.ToString(); |
| | | string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries); |
| | | string msg2 = sArray[0].ToString(); |
| | | string msg3 = sArray[1].ToString(); |
| | | string msg4 = sArray[2].ToString(); |
| | | |
| | | |
| | | string UserName = ""; |
| | | ListModels oListModels = new ListModels(); |
| | | try |
| | | { |
| | | DAL.ClsSup_QuotePriceBill oBill = new DAL.ClsSup_QuotePriceBill(); |
| | | List<Model.ClsSup_QuotePriceBillMain> lsmain = new List<Model.ClsSup_QuotePriceBillMain>(); |
| | | msg2 = msg2.Replace("\\", ""); |
| | | msg2 = msg2.Replace("\n", ""); //\n |
| | | lsmain = oListModels.getObjectByJson_ClsSup_QuotePriceBillMain(msg2); |
| | | foreach (Model.ClsSup_QuotePriceBillMain oItem in lsmain) |
| | | { |
| | | //oItem.HMaker = ""; |
| | | UserName = oItem.HMaker; //制单人 |
| | | oItem.HBillType = "1121"; |
| | | oItem.HBillSubType = "1121"; |
| | | oItem.HBillStatus = 1; |
| | | DBUtility.ClsPub.CurUserName = UserName; |
| | | oItem.HYear = DBUtility.ClsPub.isLong(DateTime.Now.Year); |
| | | |
| | | if (DBUtility.ClsPub.isStrNull(oItem.HDate) == "") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "保存失败!没有单据日期,无法保存!"; |
| | | objJsonResult.data = 1; |
| | | return objJsonResult; |
| | | } |
| | | oBill.omodel = oItem; |
| | | } |
| | | //表体数据 |
| | | //按 },{来拆分数组 //去掉【和】 |
| | | msg3 = msg3.Substring(1, msg3.Length - 2); |
| | | msg3 = msg3.Replace("\\", ""); |
| | | msg3 = msg3.Replace("\n", ""); //\n |
| | | //msg2 = msg2.Replace("'", "’"); |
| | | List<Model.ClsSup_QuotePriceBillSub> ls = new List<Model.ClsSup_QuotePriceBillSub>(); |
| | | ls = oListModels.getObjectByJson_ClsSup_QuotePriceBillSub(msg3); |
| | | int i = 0; |
| | | foreach (Model.ClsSup_QuotePriceBillSub oItemSub in ls) |
| | | { |
| | | |
| | | i++; |
| | | oItemSub.HEntryID = i; |
| | | //oItemSub.HCloseMan = ""; //行关闭 |
| | | oItemSub.HEntryCloseDate = DBUtility.ClsPub.isDate(DateTime.Now); |
| | | oItemSub.HCloseType = false; //关闭类型 |
| | | //oItemSub.HRemark = ""; //备注 |
| | | oItemSub.HSourceInterID = oItemSub.HSourceInterID; // 源单主内码 |
| | | oItemSub.HSourceEntryID = oItemSub.HSourceEntryID; //源单子内码 |
| | | oItemSub.HSourceBillNo = oItemSub.HSourceBillNo; //源单单号 |
| | | oItemSub.HSourceBillType = oItemSub.HSourceBillType; //源单类型 |
| | | oItemSub.HRelationQty = 0; //关联数量 |
| | | |
| | | oBill.DetailColl.Add(oItemSub); |
| | | |
| | | } |
| | | //保存 |
| | | //保存完毕后处理 |
| | | bool bResult; |
| | | if (oBill.omodel.HInterID == 0) |
| | | { |
| | | // bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); |
| | | bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); |
| | | } |
| | | else |
| | | { |
| | | bResult = oBill.ModifyBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo); |
| | | } |
| | | if (bResult) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "保存成功!"; |
| | | objJsonResult.data = 1; |
| | | return objJsonResult; |
| | | } |
| | | else |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "保存失败!" + DBUtility.ClsPub.sExeReturnInfo; |
| | | objJsonResult.data = 1; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "保存失败!" + e.ToString(); |
| | | objJsonResult.data = 1; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | //#region 供应商报价单 删除 |
| | | [Route("Sup_QuotePriceBill/DelQuotePriceBill")] |
| | | [HttpGet] |
| | | public object DelQuotePriceBill(string HInterID, string user) |
| | | { |
| | | Int64 lngBillKey = 0; |
| | | lngBillKey = DBUtility.ClsPub.isLong(HInterID); |
| | | if (lngBillKey == 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "单据ID为空!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | DAL.ClsSup_QuotePriceBill oBill = new DAL.ClsSup_QuotePriceBill(); |
| | | if (oBill.ShowBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo)) |
| | | { |
| | | ds = oCN.RunProcReturn("select * from Sup_QuotePriceBillMain where HInterID=" + lngBillKey, "Sup_QuotePriceBillMain"); |
| | | if (int.Parse(ds.Tables[0].Rows[0]["HBillStatus"].ToString()) > 1) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "单据当前处于不能删除状态,不能删除!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | if (ds.Tables[0].Rows[0]["HChecker"].ToString() != "") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "单据已经审核,不能删除!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | bool IsDete = oBill.DeleteBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo); |
| | | if (IsDete) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = DBUtility.ClsPub.sExeReturnInfo; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | else |
| | | { |
| | | |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = DBUtility.ClsPub.sExeReturnInfo; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "单据未找到"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | //#endregion |
| | | |
| | | #region 获取源单信息-询价单 |
| | | [Route("GetAskPriceInfo")] |
| | | [HttpGet] |
| | | public object GetAskPriceInfo(string HInterID, string HEntryID,string HIEs) |
| | | { |
| | | try |
| | | { |
| | | List<object> columnNameList = new List<object>(); |
| | | |
| | | string sql = "select * from h_v_Sup_AskPriceBill where HIEs in ( " + HIEs + ")"; |
| | | ds = oCN.RunProcReturn(sql, "h_v_Sup_QuotePriceBill"); |
| | | |
| | | //添加列名 |
| | | 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.list = columnNameList; |
| | | objJsonResult.data = ds.Tables[0]; |
| | | return objJsonResult; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "Exception!" + e.ToString(); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | } |
| | | } |
| | |
| | | using Microsoft.AspNet.SignalR; |
| | | using Model; |
| | | using Newtonsoft.Json.Linq; |
| | | using Pub_Class; |
| | | using SQLHelper; |
| | | using System; |
| | | using System.Collections.Generic; |
| | |
| | | { |
| | | ClsCNSRM oCn = new ClsCNSRM(); |
| | | oCn.BeginTran(); |
| | | oCn.RunProc("Update OA_InformBillSub set HReadFlag=1 HUpDater='" + UserName + "',HUpDateDate=getdate() where HInterID='" + HInterID + "' and HEntryID='" + HEntryID + "'", ref ClsPub.sExeReturnInfo); |
| | | oCn.RunProc("Update OA_InformBillSub set HReadFlag=1 HUpDater='" + UserName + "',HUpDateDate=getdate() where HInterID='" + HInterID + "' and HEntryID='" + HEntryID + "'", ref Pub_Class.ClsPub.sExeReturnInfo); |
| | | oCn.Commit(); |
| | | objjson.code = "1"; |
| | | objjson.count = 1; |
| | | objjson.Message = ClsPub.sExeReturnInfo; |
| | | objjson.Message = Pub_Class.ClsPub.sExeReturnInfo; |
| | | objjson.data = null; |
| | | return objjson; ; |
| | | } |
| | |
| | | } |
| | | #endregion |
| | | |
| | | /// <summary> |
| | | /// 表头信息 |
| | | /// </summary> |
| | | /// <param name="sMsg"></param> |
| | | /// <returns></returns> |
| | | [Route("Web/GetMAXNum")] |
| | | [HttpGet] |
| | | public object GetMAXNum(string HBillType) |
| | | { |
| | | try |
| | | { |
| | | string HBillNo = ""; |
| | | Int64 HInterID = 0;//显示的字段 |
| | | HInterID = DBUtility.ClsPub.CreateBillID(HBillType, ref DBUtility.ClsPub.sExeReturnInfo); |
| | | HBillNo = DBUtility.ClsPub.CreateBillCode(HBillType, ref DBUtility.ClsPub.sExeReturnInfo, true); |
| | | //----------创建虚表------------------------ |
| | | DataTable dt_Main = new DataTable("Json"); |
| | | dt_Main.Columns.Add("HBillNo", typeof(string)); |
| | | dt_Main.Columns.Add("HInterID", typeof(int)); |
| | | //---------创建新行------------------------ |
| | | DataRow dr_main = dt_Main.NewRow();//创建新行 |
| | | dt_Main.Rows.Add(dr_main);//将新行加入到表中 |
| | | dr_main["HBillNo"] = DBUtility.ClsPub.isStrNull(HBillNo); |
| | | dr_main["HInterID"] = DBUtility.ClsPub.isLong(HInterID); |
| | | |
| | | if (HBillNo == null || HInterID == 0) |
| | | { |
| | | objjson.code = "0"; |
| | | objjson.count = 0; |
| | | objjson.Message = "获取失败"; |
| | | objjson.data = null; |
| | | return objjson; |
| | | } |
| | | else |
| | | { |
| | | objjson.code = "0"; |
| | | objjson.count = 1; |
| | | objjson.Message = "获取成功"; |
| | | objjson.data = dt_Main; |
| | | return objjson; |
| | | } |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | objjson.code = "0"; |
| | | objjson.count = 0; |
| | | objjson.Message = "获取失败" + e.ToString(); |
| | | objjson.data = null; |
| | | return objjson; |
| | | } |
| | | } |
| | | |
| | | //得到最大HINTERID |
| | | public static Int64 CreateBillID(string BillCode, ref string sReturn) |
| | | { |
| | | string BillType = ""; |
| | | DataSet Ds; |
| | | ClsSqlHelper oCn = new ClsSqlHelper(); |
| | | Int64 lID; |
| | | Ds = oCn.RunProcReturn("select * from Gy_BillNumber with (nolock) where BillCode='" + BillCode.Trim() + "'", "Gy_BillNumber"); |
| | | if (Ds.Tables[0].Rows.Count != 0) |
| | | { |
| | | lID = Pub_Class.ClsPub.isLong(Ds.Tables[0].Rows[0]["IDNow"].ToString()); |
| | | BillType = Ds.Tables[0].Rows[0]["BillType"].ToString().Trim(); |
| | | } |
| | | else |
| | | { |
| | | lID = 0; |
| | | } |
| | | //同类型单据 自增1 |
| | | if (BillType.Trim() != "") |
| | | { |
| | | oCn.RunProc("update Gy_BillNumber set IDNow=IDNow+1 where BillType='" + BillType.Trim() + "'"); |
| | | } |
| | | oCn.CnClose(); |
| | | oCn.CnDispose(); |
| | | oCn = null; |
| | | Ds = null; |
| | | return lID; |
| | | } |
| | | |
| | | //得到最大单据号 |
| | | public static string CreateBillCode(string BillCode, ref string sReturn, bool Add) |
| | | { |
| | | Int64 BillCodeMode; |
| | | string Profix; |
| | | Int64 Glida; |
| | | Int32 CodeLen; |
| | | string sBillNo = ""; |
| | | char c = Convert.ToChar("0"); |
| | | string sKjYear = DateTime.Today.Year.ToString(); |
| | | string sPeriod = DateTime.Today.Month.ToString(); |
| | | string sDay = DateTime.Today.Day.ToString(); |
| | | //得到单据号表 信息 |
| | | ClsSqlHelper oCn = new ClsSqlHelper(); |
| | | DataSet Ds = new DataSet(); |
| | | Ds = oCn.RunProcReturn("Select * from Gy_BillNumber where BillCode='" + BillCode.Trim() + "'", "Gy_BillNumber"); |
| | | if (Ds.Tables[0].Rows.Count != 0) |
| | | { |
| | | BillCodeMode = Pub_Class.ClsPub.isLong(Ds.Tables[0].Rows[0]["BillCodeMode"].ToString()); |
| | | Profix = Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["Profix"].ToString()); |
| | | Glida = Pub_Class.ClsPub.isLong(Ds.Tables[0].Rows[0]["Glida"].ToString()); |
| | | CodeLen = Pub_Class.ClsPub.isInt(Ds.Tables[0].Rows[0]["CodeLen"].ToString()); |
| | | } |
| | | else |
| | | { |
| | | return ""; |
| | | } |
| | | // |
| | | string sStr; |
| | | switch (BillCodeMode) |
| | | { |
| | | case 0: |
| | | switch (Glida) |
| | | { |
| | | case 0://纯流水号 |
| | | Ds = oCn.RunProcReturn("Select * from Gy_MaxNum where BillCode='" + BillCode.Trim() + "'", "Gy_MaxNum"); |
| | | if (Ds.Tables[0].Rows.Count != 0) |
| | | { |
| | | sStr = new string(c, CodeLen - (Ds.Tables[0].Rows[0]["NowNumBer"].ToString()).Length); |
| | | sBillNo = Profix.Trim() + sStr + Ds.Tables[0].Rows[0]["NowNumBer"].ToString().Trim(); |
| | | } |
| | | else //插入新记录 |
| | | { |
| | | sStr = new string(c, CodeLen - 1); |
| | | oCn.RunProc("insert into Gy_MaxNum(BillCode,NowNumber) values('" + BillCode.Trim() + "',1)"); |
| | | sBillNo = Profix.Trim() + sStr + 1; |
| | | } |
| | | if (Add == true) |
| | | { |
| | | oCn.RunProc("update Gy_Maxnum set NowNumBer=NowNumBer+1 where BillCode='" + BillCode.Trim() + "'"); |
| | | } |
| | | return sBillNo; |
| | | |
| | | case 1://根据 YY年+MM月 日 + 流水号 生成单据号 (日 采用了 仓库的字段) |
| | | sKjYear = sKjYear.Substring(2, 2); |
| | | sPeriod = "0" + sPeriod; |
| | | sPeriod = sPeriod.Substring(sPeriod.Length - 2, 2); |
| | | sDay = ""; |
| | | Ds = oCn.RunProcReturn("Select * from Gy_MaxNum where BillCode='" + BillCode.Trim() + "' and KjYear='" + sKjYear + "' and Period='" + sPeriod + "' and whcode='" + sDay + "'", "Gy_MaxNum"); |
| | | if (Ds.Tables[0].Rows.Count != 0) |
| | | { |
| | | sStr = new string(c, CodeLen - (Ds.Tables[0].Rows[0]["NowNumBer"].ToString()).Length); |
| | | sBillNo = Profix.Trim() + sKjYear + sPeriod + sDay + sStr + Ds.Tables[0].Rows[0]["NowNumBer"].ToString().Trim(); |
| | | } |
| | | else //插入新记录 |
| | | { |
| | | sStr = new string(c, CodeLen - 1); |
| | | oCn.RunProc("insert into Gy_Maxnum(BillCode,Kjyear,Period,whcode,NowNumber) values('" + BillCode.Trim() + "','" + sKjYear + "','" + sPeriod + "','" + sDay + "',1)"); |
| | | sBillNo = Profix.Trim() + sKjYear + sPeriod + sDay + sStr + "1"; |
| | | } |
| | | if (Add == true) |
| | | { |
| | | oCn.RunProc("update Gy_Maxnum set NowNumBer=NowNumBer+1 where BillCode='" + BillCode.Trim() + "' and KjYear='" + sKjYear + "' and Period='" + sPeriod + "' and whcode='" + sDay + "'"); |
| | | } |
| | | return sBillNo; |
| | | case 2: //根据年+月+日 生成单据号 |
| | | Ds = oCn.RunProcReturn("Select * from Gy_MaxNum where BillCode='" + BillCode.Trim() + "' and KjYear='" + sKjYear + "' and Period='" + sPeriod + "' and whcode='" + sDay + "'", "Gy_MaxNum"); |
| | | if (Ds.Tables[0].Rows.Count != 0) |
| | | { |
| | | sStr = new string(c, CodeLen - (Ds.Tables[0].Rows[0]["NowNumBer"].ToString()).Length); |
| | | sBillNo = Profix.Trim() + sKjYear + Pub_Class.ClsPub.isStrNull(("0" + sPeriod)).Substring(Pub_Class.ClsPub.isStrNull(("0" + sPeriod)).Length - 2, 2) + Pub_Class.ClsPub.isStrNull(("0" + sDay)).Substring(Pub_Class.ClsPub.isStrNull(("0" + sDay)).Length - 2, 2) + sStr + Ds.Tables[0].Rows[0]["NowNumBer"].ToString().Trim(); |
| | | } |
| | | else //插入新记录 |
| | | { |
| | | sStr = new string(c, CodeLen - 1); |
| | | oCn.RunProc("insert into Gy_Maxnum(BillCode,Kjyear,Period,whcode,NowNumber) values('" + BillCode.Trim() + "','" + sKjYear + "','" + sPeriod + "','" + sDay + "',1)"); |
| | | sBillNo = Profix.Trim() + sKjYear + Pub_Class.ClsPub.isStrNull(("0" + sPeriod)).Substring(Pub_Class.ClsPub.isStrNull(("0" + sPeriod)).Length - 2, 2) + Pub_Class.ClsPub.isStrNull(("0" + sDay)).Substring(Pub_Class.ClsPub.isStrNull(("0" + sDay)).Length - 2, 2) + sStr + 1; |
| | | } |
| | | if (Add == true) |
| | | { |
| | | oCn.RunProc("update Gy_Maxnum set NowNumBer=NowNumBer+1 where BillCode='" + BillCode.Trim() + "' and KjYear='" + sKjYear + "' and Period='" + sPeriod + "' and whcode='" + sDay + "'"); |
| | | } |
| | | return sBillNo; |
| | | case 3: //根据 乔一 (S + 年(23)+五位流水号)实例:S2300001 |
| | | Ds = oCn.RunProcReturn("Select * from Gy_MaxNum where BillCode='" + BillCode.Trim() + "' and KjYear='0' and whcode=''", "Gy_MaxNum"); |
| | | sKjYear = sKjYear.Substring(2, 2); |
| | | if (Ds.Tables[0].Rows.Count != 0) |
| | | { |
| | | sStr = new string(c, CodeLen - (Ds.Tables[0].Rows[0]["NowNumBer"].ToString()).Length); |
| | | Profix = Profix.Substring(0, 1); |
| | | sBillNo = Profix.Trim() + sKjYear + sStr + Ds.Tables[0].Rows[0]["NowNumBer"].ToString().Trim(); |
| | | } |
| | | else //插入新记录 |
| | | { |
| | | sStr = new string(c, CodeLen - 1); |
| | | oCn.RunProc("insert into Gy_Maxnum(BillCode,Kjyear,Period,whcode,NowNumber) values('" + BillCode.Trim() + "','" + sKjYear + "','" + sPeriod + "','" + sDay + "',1)"); |
| | | sBillNo = Profix.Trim() + sKjYear + sStr + 1; |
| | | } |
| | | if (Add == true) |
| | | { |
| | | oCn.RunProc("update Gy_Maxnum set NowNumBer=NowNumBer+1 where BillCode='" + BillCode.Trim() + "' and KjYear='0' and whcode=''"); |
| | | } |
| | | return sBillNo; |
| | | case 4: //根据 乔一 工序流转卡号改成年+月+四位流水号(23050001) |
| | | Ds = oCn.RunProcReturn("Select * from Gy_MaxNum where BillCode='" + BillCode.Trim() + "' and KjYear='0' and whcode=''", "Gy_MaxNum"); |
| | | sKjYear = sKjYear.Substring(2, 2); |
| | | sPeriod = "0" + sPeriod; |
| | | sPeriod = sPeriod.Substring(sPeriod.Length - 2, 2); |
| | | if (Ds.Tables[0].Rows.Count != 0) |
| | | { |
| | | sStr = new string(c, CodeLen - (Ds.Tables[0].Rows[0]["NowNumBer"].ToString()).Length); |
| | | sBillNo = sKjYear + sPeriod + sStr + Ds.Tables[0].Rows[0]["NowNumBer"].ToString().Trim(); |
| | | } |
| | | else //插入新记录 |
| | | { |
| | | sStr = new string(c, CodeLen - 1); |
| | | oCn.RunProc("insert into Gy_Maxnum(BillCode,Kjyear,Period,whcode,NowNumber) values('" + BillCode.Trim() + "','" + sKjYear + "','" + sPeriod + "','" + sDay + "',1)"); |
| | | sBillNo = sKjYear + sPeriod + sStr + 1; |
| | | } |
| | | if (Add == true) |
| | | { |
| | | oCn.RunProc("update Gy_Maxnum set NowNumBer=NowNumBer+1 where BillCode='" + BillCode.Trim() + "' and KjYear='0' and whcode=''"); |
| | | } |
| | | return sBillNo; |
| | | default: |
| | | return sBillNo; |
| | | |
| | | } |
| | | |
| | | case 1: |
| | | return sBillNo; |
| | | |
| | | default: |
| | | return sBillNo; |
| | | |
| | | } |
| | | oCn.CnClose(); |
| | | oCn.CnDispose(); |
| | | oCn = null; |
| | | } |
| | | |
| | | } |
| | | } |
| | |
| | | return list; |
| | | } |
| | | |
| | | public List<Model.ClsSup_QuotePriceBillMain> getObjectByJson_ClsSup_QuotePriceBillMain(string jsonString) |
| | | { |
| | | jsonString = "[" + jsonString.ToString() + "]"; |
| | | List<Model.ClsSup_QuotePriceBillMain> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsSup_QuotePriceBillMain>>(jsonString); |
| | | return list; |
| | | } |
| | | public List<Model.ClsSup_QuotePriceBillSub> getObjectByJson_ClsSup_QuotePriceBillSub(string jsonString) |
| | | { |
| | | jsonString = "[" + jsonString.ToString() + "]"; |
| | | List<Model.ClsSup_QuotePriceBillSub> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsSup_QuotePriceBillSub>>(jsonString); |
| | | return list; |
| | | } |
| | | |
| | | } |
| | | } |
| | |
| | | <Compile Include="Code\Common.cs" /> |
| | | <Compile Include="Code\Test2.cs" /> |
| | | <Compile Include="Code\TestDAL.cs" /> |
| | | <Compile Include="Controllers\BasicInfoController.cs" /> |
| | | <Compile Include="Controllers\QuotePriceBilController.cs" /> |
| | | <Compile Include="Controllers\BarCodeController.cs" /> |
| | | <Compile Include="Controllers\NpoiHelper.cs" /> |