コード例 #1
0
        //物料:flag= "0" 入库单:1  出库单 2
        public bool GetVoucherNo(string Erpvoucherno, ref string ErrorMsg, string flag = "0")
        {
            if (string.IsNullOrEmpty(Erpvoucherno))
            {
                ErrorMsg = "单据号不能为空";
                return(false);
            }
            int    WmsVoucherType = 9999; string syncType = "ERP"; int syncExcelVouType = -1; DataSet excelds = null; int StockType = 0;
            string tableName = "t_material";

            if (Erpvoucherno.Contains("Wgr"))//成品入库单
            {
                tableName      = " T_instock";
                StockType      = 10;
                WmsVoucherType = 50;
            }
            if (Erpvoucherno.Contains("RE"))//退回处理单
            {
                tableName      = " T_instock";
                StockType      = 10;
                WmsVoucherType = 47;
            }
            if (Erpvoucherno.Contains("MO"))//生产订单
            {
                tableName      = " T_Product";
                StockType      = 10;
                WmsVoucherType = 51;
            }
            if (Erpvoucherno.Contains("SM"))//销售出货单
            {
                tableName      = " T_Task";
                StockType      = 20;
                WmsVoucherType = 46;
            }
            if (Erpvoucherno.Contains("Tra"))//形态转换单
            {
                StockType      = 10;
                WmsVoucherType = 52;
            }
            if (Erpvoucherno.Contains("DC"))//调拨出库单
            {
                if (flag == "1")
                {
                    tableName      = " T_instock";
                    StockType      = 10;
                    WmsVoucherType = 30;
                }
                else
                {
                    tableName      = " T_Task";
                    StockType      = 20;
                    WmsVoucherType = 31;
                }
            }
            if (Erpvoucherno.Contains("DR"))//调拨入库单
            {
                tableName      = " T_instock";
                StockType      = 10;
                WmsVoucherType = 30;
            }
            if (Erpvoucherno.Contains("ZF"))//杂发单
            {
                StockType      = 20;
                WmsVoucherType = 0;
            }
            if (WmsVoucherType == 0 || tableName == "")
            {
                ErrorMsg = "找不到该单据类型!";
                return(false);
            }
            if (flag != "0")
            {
                //查看单据是否存在
                T_Material_DB DB = new T_Material_DB();
                if (DB.GetCount("SELECT count(1) FROM " + tableName + " WHERE erpvoucherno ='" + Erpvoucherno + "'") > 0)
                {
                    return(true);
                }

                //using (var db = SqlSugarBase.GetInstance())
                //{
                //    if (db.Ado.GetInt("SELECT count(1) FROM " + tableName + " WHERE erpvoucherno ='" + Erpvoucherno + "'") > 0)
                //    {
                //        return true;
                //    }
                //}
            }

            //同步单据
            if (SyncErp.SyncJsonFromErp(StockType, string.Empty, Erpvoucherno, WmsVoucherType, ref ErrorMsg))
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
コード例 #2
0
 /// <summary>
 ///  同步数据
 /// </summary>
 /// <param name="StockType">类型 10:入库 20:出库  99:基础资料</param>
 /// <param name="LastSyncTime">最后同步时间</param>
 /// <param name="ErpVoucherNo">ERP单号</param>
 /// <param name="wmsVourcherType">wms单据类型</param>
 /// <param name="ErrMsg">返回错误信息</param>
 /// <param name="syncType">同步数据来源 ERP或者 EXCEL</param>
 /// <param name="syncExcelVouType">Excel单据类型</param>
 /// <param name="ds">EXCEL单据数据</param>
 /// <returns>成功 true</returns>
 public bool Sync(int StockType, string LastSyncTime, string ErpVoucherNo, int wmsVourcherType, ref string ErrMsg, string syncType, int syncExcelVouType, DataSet ds)
 {
     return SyncErp.SyncJsonFromErp(StockType, LastSyncTime, ErpVoucherNo, wmsVourcherType, ref ErrMsg);
 }
コード例 #3
0
 public bool SyncSAP(int StockType, string LastSyncTime, string ErpVoucherNo, int wmsVourcherType, string InJson, ref string ErrMsg)
 {
     return(SyncErp.SyncSAPJsonFromErp(StockType, LastSyncTime, ErpVoucherNo, wmsVourcherType, InJson, ref ErrMsg));
 }