|
|
|
|
using System;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Web.Mvc;
|
|
|
|
|
using DSWeb.MvcShipping.Models.WMSNew;
|
|
|
|
|
using DSWeb.MvcShipping.Models.MsStevedores;
|
|
|
|
|
using DSWeb.MvcShipping.DAL.WMSNewDAL;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Data;
|
|
|
|
|
using System.IO;
|
|
|
|
|
using HcUtility.Comm;
|
|
|
|
|
using DSWeb.Areas.MvcShipping.DAL.Message;
|
|
|
|
|
using DSWeb.MvcShipping.DAL.MsSysBillNoSet;
|
|
|
|
|
using DSWeb.MvcShipping.DAL.MsCodeFtpSet;
|
|
|
|
|
|
|
|
|
|
using DSWeb.TruckMng.Comm.Cookie;
|
|
|
|
|
using DSWeb.TruckMng.Helper;
|
|
|
|
|
using DSWeb.TruckMng.Helper.Repository;
|
|
|
|
|
using System.Web.Script.Serialization;
|
|
|
|
|
using System.Collections;
|
|
|
|
|
using System.Data.OleDb;
|
|
|
|
|
using DSWeb.Areas.CommMng.DAL;
|
|
|
|
|
using DSWeb.MvcShipping.DAL.WMSDeliver;
|
|
|
|
|
using DSWeb.MvcShipping.DAL.MsSysParamSet;
|
|
|
|
|
|
|
|
|
|
namespace DSWeb.MvcShipping.Controllers
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
public class WMSNewController : Controller
|
|
|
|
|
{
|
|
|
|
|
//
|
|
|
|
|
// GET:
|
|
|
|
|
public ActionResult Index ( )
|
|
|
|
|
{
|
|
|
|
|
return View();
|
|
|
|
|
}
|
|
|
|
|
//
|
|
|
|
|
// GET: /
|
|
|
|
|
public ActionResult Edit ( )
|
|
|
|
|
{
|
|
|
|
|
return View();
|
|
|
|
|
}
|
|
|
|
|
public ActionResult InEdit ( )
|
|
|
|
|
{
|
|
|
|
|
return View();
|
|
|
|
|
}
|
|
|
|
|
public ContentResult GetDataList ( int start, int limit, string sort, string condition )
|
|
|
|
|
{
|
|
|
|
|
int count = 0;
|
|
|
|
|
|
|
|
|
|
var dataList = WMSNewDAL.GetDataList(condition, start, limit, CookieConfig.GetCookie_UserId(Request), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]), out count, sort);
|
|
|
|
|
var timeStamp = DateTime.Now.ToShortDateString();
|
|
|
|
|
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = count, data = dataList.ToList(), timeStamp = timeStamp });
|
|
|
|
|
return new ContentResult() { Content = json };
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public ContentResult GetDataList_LTJY(int start, int limit, string sort, string condition)
|
|
|
|
|
{
|
|
|
|
|
int count = 0;
|
|
|
|
|
var dataList = WMSNewDAL.GetDataList_LTJY(condition, start, limit, CookieConfig.GetCookie_UserId(Request), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]), out count, sort);
|
|
|
|
|
var timeStamp = DateTime.Now.ToShortDateString();
|
|
|
|
|
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = count, data = dataList.ToList(), timeStamp = timeStamp });
|
|
|
|
|
return new ContentResult() { Content = json };
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public ContentResult GetData ( string handle, string condition )
|
|
|
|
|
{
|
|
|
|
|
WMSNewList head = null;
|
|
|
|
|
var timeStamp = DateTime.Now.ToShortDateString();
|
|
|
|
|
var wmsnoManual = "0";
|
|
|
|
|
if (handle == "edit")
|
|
|
|
|
{
|
|
|
|
|
head = WMSNewDAL.GetData(condition, CookieConfig.GetCookie_UserId(Request), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]));
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (head == null)
|
|
|
|
|
{
|
|
|
|
|
head = new WMSNewList();
|
|
|
|
|
head.ARFEE = "0";
|
|
|
|
|
head.APFEE = "0";
|
|
|
|
|
head.CHARGEUNIT = "吨";
|
|
|
|
|
head.GOODSKGS = "0";
|
|
|
|
|
}
|
|
|
|
|
wmsnoManual = WMSNewDAL.GetWMSNOManualConfig();
|
|
|
|
|
var json = JsonConvert.Serialize(
|
|
|
|
|
new { Success = true, Message = "查询成功", data = head, timeStamp = timeStamp,WMSNOManual=wmsnoManual });
|
|
|
|
|
return new ContentResult() { Content = json };
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public ContentResult GetData_LTJY(string handle, string condition)
|
|
|
|
|
{
|
|
|
|
|
WMSNewList head = null;
|
|
|
|
|
var timeStamp = DateTime.Now.ToShortDateString();
|
|
|
|
|
var wmsnoManual = "0";
|
|
|
|
|
if (handle == "edit")
|
|
|
|
|
{
|
|
|
|
|
head = WMSNewDAL.GetData_LTJY(condition, CookieConfig.GetCookie_UserId(Request), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (head == null)
|
|
|
|
|
{
|
|
|
|
|
head = new WMSNewList();
|
|
|
|
|
head.ARFEE = "0";
|
|
|
|
|
head.APFEE = "0";
|
|
|
|
|
head.CHARGEUNIT = "箱";
|
|
|
|
|
}
|
|
|
|
|
wmsnoManual = WMSNewDAL.GetWMSNOManualConfig();
|
|
|
|
|
var json = JsonConvert.Serialize(
|
|
|
|
|
new { Success = true, Message = "查询成功", data = head, timeStamp = timeStamp, WMSNOManual = wmsnoManual });
|
|
|
|
|
return new ContentResult() { Content = json };
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public ContentResult Delete ( string data, string USERID )
|
|
|
|
|
{
|
|
|
|
|
var WMSNewList = JsonConvert.Deserialize<List<WMSNewList>>(data);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
string msg = "";
|
|
|
|
|
|
|
|
|
|
bool success = WMSNewDAL.Delete(WMSNewList,out msg);
|
|
|
|
|
|
|
|
|
|
var jsonRespose = new JsonResponse { Success = success, Message = msg };
|
|
|
|
|
|
|
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private List<WMSNewList> serializeParams ( List<WMSNewList> list )
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
return list;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public ContentResult Save ( string opstatus, string data, string WMSINBody, string WMSINBodyDel)
|
|
|
|
|
{
|
|
|
|
|
var head = JsonConvert.Deserialize<WMSNew>(data);
|
|
|
|
|
var WMSINBodyList = JsonConvert.Deserialize<List<WMSNewIN>>(WMSINBody);
|
|
|
|
|
var WMSINBodyDelList = JsonConvert.Deserialize<List<WMSNewIN>>(WMSINBodyDel);
|
|
|
|
|
if (WMSINBodyList!=null)
|
|
|
|
|
{
|
|
|
|
|
foreach (var item in WMSINBodyList)
|
|
|
|
|
{
|
|
|
|
|
item.STORAGENAME = head.STORAGENAME;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (head.WMSDATE == "")
|
|
|
|
|
{
|
|
|
|
|
head.WMSDATE = DateTime.Now.ToString("yyyy-MM-dd");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var CustomsNo = head.CUSTOMNO;
|
|
|
|
|
var BSNO = head.ASSOCIATEDNO;
|
|
|
|
|
var BLNO = head.BLNO;
|
|
|
|
|
var CONTRACTNO = head.CONTRACTNO;
|
|
|
|
|
var jsonRespose = new JsonResponse();
|
|
|
|
|
//检查是否报关
|
|
|
|
|
bool ISCustomsClearance = WMSNewDAL.CheckISCustomsClearance(CustomsNo,BLNO);
|
|
|
|
|
if (!ISCustomsClearance)
|
|
|
|
|
{
|
|
|
|
|
jsonRespose.Success = false;
|
|
|
|
|
jsonRespose.Message = "未进行报关,不允许入库!";
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if (opstatus == "add")
|
|
|
|
|
{
|
|
|
|
|
/*if (WMSINBodyList!=null && WMSINBodyList.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
head.GOODSNAMEID = WMSINBodyList[0].GOODSNAMEID;
|
|
|
|
|
head.GOODSNAME = WMSINBodyList[0].GOODSNAME;
|
|
|
|
|
}
|
|
|
|
|
*/
|
|
|
|
|
head.DbOperationType = DbOperationType.DbotIns;
|
|
|
|
|
head.ModelUIStatus = "I";
|
|
|
|
|
head.CORPID = Convert.ToString(Session["COMPANYID"]).Trim();//CORPID
|
|
|
|
|
head.GID = "Wms" + Guid.NewGuid().ToString().Replace("-", ""); ;//获取管理费单号
|
|
|
|
|
head.WMSOP = CookieConfig.GetCookie_UserName(Request);
|
|
|
|
|
head.CREATEUSER = CookieConfig.GetCookie_UserId(Request);
|
|
|
|
|
head.MODIFIEDTIME = head.CREATETIME;
|
|
|
|
|
head.MODIFIEDUSER = head.CREATEUSER;
|
|
|
|
|
//head.WMSNO = getCodeRule("入库单号", "WMSNO", "WMS", head.WMSDATE);//调用编码规则
|
|
|
|
|
if (head.WMSNO==""||head.WMSNO==null)
|
|
|
|
|
{
|
|
|
|
|
var billnoset = MsSysBillNoSetDAL.GetData("OPLBNAME='仓储入库'", Convert.ToString(Session["COMPANYID"]));
|
|
|
|
|
head.WMSNO = MsSysBillNoSetDAL.GetBillNo(billnoset, head.WMSDATE.ToString().Trim(), head.ACCDATE.ToString().Trim());
|
|
|
|
|
if (head.WMSNO == null || head.WMSNO == string.Empty)
|
|
|
|
|
{
|
|
|
|
|
jsonRespose.Success = false;
|
|
|
|
|
jsonRespose.Message = "入库单号生成失败!";
|
|
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (head.ASSOCIATEDNO == "")
|
|
|
|
|
{
|
|
|
|
|
//不是海运进口和进口贸易,关联号设置和GID相等。见v_op_bs,2019-05-24
|
|
|
|
|
head.ASSOCIATEDNO = head.GID;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else if (opstatus == "edit")
|
|
|
|
|
{
|
|
|
|
|
if (WMSINBodyList!=null)
|
|
|
|
|
{
|
|
|
|
|
/*if (WMSINBodyList.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
head.GOODSNAMEID = WMSINBodyList[0].GOODSNAMEID;
|
|
|
|
|
head.GOODSNAME = WMSINBodyList[0].GOODSNAME;
|
|
|
|
|
}*/
|
|
|
|
|
if (head.EIP)
|
|
|
|
|
{
|
|
|
|
|
foreach (var wmsin in WMSINBodyList)
|
|
|
|
|
{
|
|
|
|
|
if ((wmsin.TRAYNO == null) || (wmsin.TRAYNO == ""))
|
|
|
|
|
{
|
|
|
|
|
//wmsin.TRAYNO = MsSysBillNoSetDAL.GetTrayNo();
|
|
|
|
|
WMSEIPSDeliverDAL.UpdateTrayNo(wmsin.GID, wmsin.TRAYNO, head.STORAGENAME);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (head.ISCHANGE == "货权转移")
|
|
|
|
|
{
|
|
|
|
|
head.ISCHANGE = "True";
|
|
|
|
|
head.FREESTORAGEPERIODAP = "0";
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
head.ISCHANGE = "False";
|
|
|
|
|
}
|
|
|
|
|
head.CREATEUSER = head.CREATEUSER;
|
|
|
|
|
head.DbOperationType = DbOperationType.DbotUpd;
|
|
|
|
|
head.ModelUIStatus = "E";
|
|
|
|
|
head.MODIFIEDTIME = DateTime.Now.ToString();
|
|
|
|
|
head.MODIFIEDUSER = CookieConfig.GetCookie_UserId(Request);
|
|
|
|
|
head.CORPID = Convert.ToString(Session["COMPANYID"]).Trim();//CORPID
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
head.DbOperationType = DbOperationType.DbotDel;
|
|
|
|
|
}
|
|
|
|
|
if (WMSINBodyList!=null)
|
|
|
|
|
{
|
|
|
|
|
foreach (var wmsin in WMSINBodyList)
|
|
|
|
|
{
|
|
|
|
|
wmsin.BSNO = BSNO;
|
|
|
|
|
wmsin.CONTRACTNO = CONTRACTNO;
|
|
|
|
|
wmsin.BLNO = BLNO;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (head.TiDanJianShu == "") head.TiDanJianShu = "0";
|
|
|
|
|
if (head.TiDanZhongLiang == "") head.TiDanZhongLiang = "0";
|
|
|
|
|
|
|
|
|
|
var modb = new ModelObjectRepository();
|
|
|
|
|
DBResult result;
|
|
|
|
|
if (WMSINBodyList==null)
|
|
|
|
|
{
|
|
|
|
|
WMSINBodyList = new List<WMSNewIN>();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
result = modb.Save(head,
|
|
|
|
|
ModelObjectConvert<WMSNewIN>.ToModelObjectList(WMSINBodyList),
|
|
|
|
|
ModelObjectConvert<WMSNewIN>.ToModelObjectList(WMSINBodyDelList)
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
jsonRespose.Success = result.Success;
|
|
|
|
|
jsonRespose.Message = result.Message;
|
|
|
|
|
jsonRespose.Data = WMSNewDAL.GetData(" GID='" + head.GID + "'", CookieConfig.GetCookie_UserId(Request), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]));
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//p_op_gain(head.BXGID);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public ContentResult Save_LTJY(string opstatus, string data, string WMSINBody, string WMSINBodyDel)
|
|
|
|
|
{
|
|
|
|
|
var head = JsonConvert.Deserialize<WMSNew>(data);
|
|
|
|
|
var WMSINBodyList = JsonConvert.Deserialize<List<WMSNewIN>>(WMSINBody);
|
|
|
|
|
var WMSINBodyDelList = JsonConvert.Deserialize<List<WMSNewIN>>(WMSINBodyDel);
|
|
|
|
|
if (WMSINBodyList != null)
|
|
|
|
|
{
|
|
|
|
|
foreach (var item in WMSINBodyList)
|
|
|
|
|
{
|
|
|
|
|
item.STORAGENAME = head.STORAGENAME;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (head.WMSDATE == "")
|
|
|
|
|
{
|
|
|
|
|
head.WMSDATE = DateTime.Now.ToString("yyyy-MM-dd");
|
|
|
|
|
}
|
|
|
|
|
var CustomsNo = head.CUSTOMNO;
|
|
|
|
|
var BSNO = head.ASSOCIATEDNO;
|
|
|
|
|
var BLNO = head.BLNO;
|
|
|
|
|
var CONTRACTNO = head.CONTRACTNO;
|
|
|
|
|
var jsonRespose = new JsonResponse();
|
|
|
|
|
//检查是否报关
|
|
|
|
|
bool ISCustomsClearance = WMSNewDAL.CheckISCustomsClearance(CustomsNo, BLNO);
|
|
|
|
|
if (!ISCustomsClearance)
|
|
|
|
|
{
|
|
|
|
|
jsonRespose.Success = false;
|
|
|
|
|
jsonRespose.Message = "未进行报关,不允许入库!";
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if (opstatus == "add")
|
|
|
|
|
{
|
|
|
|
|
if (WMSINBodyList != null && WMSINBodyList.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
head.GOODSNAMEID = WMSINBodyList[0].GOODSNAMEID;
|
|
|
|
|
head.GOODSNAME = WMSINBodyList[0].GOODSNAME;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
head.DbOperationType = DbOperationType.DbotIns;
|
|
|
|
|
head.ModelUIStatus = "I";
|
|
|
|
|
head.CORPID = Convert.ToString(Session["COMPANYID"]).Trim();//CORPID
|
|
|
|
|
head.GID = "Wms" + Guid.NewGuid().ToString().Replace("-", ""); ;//获取管理费单号
|
|
|
|
|
head.WMSOP = CookieConfig.GetCookie_UserName(Request);
|
|
|
|
|
head.CREATEUSER = CookieConfig.GetCookie_UserId(Request);
|
|
|
|
|
//head.WMSNO = getCodeRule("入库单号", "WMSNO", "WMS", head.WMSDATE);//调用编码规则
|
|
|
|
|
if (head.WMSNO == "" || head.WMSNO == null)
|
|
|
|
|
{
|
|
|
|
|
var billnoset = MsSysBillNoSetDAL.GetData("OPLBNAME='仓储入库'", Convert.ToString(Session["COMPANYID"]));
|
|
|
|
|
head.WMSNO = MsSysBillNoSetDAL.GetBillNo(billnoset, head.WMSDATE.ToString().Trim(), head.ACCDATE.ToString().Trim());
|
|
|
|
|
if (head.WMSNO == null || head.WMSNO == string.Empty)
|
|
|
|
|
{
|
|
|
|
|
jsonRespose.Success = false;
|
|
|
|
|
jsonRespose.Message = "入库单号生成失败!";
|
|
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (head.ASSOCIATEDNO == "")
|
|
|
|
|
{
|
|
|
|
|
head.ASSOCIATEDNO = head.GID;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else if (opstatus == "edit")
|
|
|
|
|
{
|
|
|
|
|
if (WMSINBodyList != null)
|
|
|
|
|
{
|
|
|
|
|
if (WMSINBodyList.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
head.GOODSNAMEID = WMSINBodyList[0].GOODSNAMEID;
|
|
|
|
|
head.GOODSNAME = WMSINBodyList[0].GOODSNAME;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (head.ISCHANGE == "货权转移")
|
|
|
|
|
{
|
|
|
|
|
head.ISCHANGE = "True";
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
head.ISCHANGE = "False";
|
|
|
|
|
}
|
|
|
|
|
head.CREATEUSER = head.CREATEUSER;
|
|
|
|
|
head.DbOperationType = DbOperationType.DbotUpd;
|
|
|
|
|
head.ModelUIStatus = "E";
|
|
|
|
|
head.MODIFIEDTIME = DateTime.Now.ToString();
|
|
|
|
|
head.MODIFIEDUSER = CookieConfig.GetCookie_UserId(Request);
|
|
|
|
|
head.CORPID = Convert.ToString(Session["COMPANYID"]).Trim();//CORPID
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
head.DbOperationType = DbOperationType.DbotDel;
|
|
|
|
|
}
|
|
|
|
|
if (WMSINBodyList != null)
|
|
|
|
|
{
|
|
|
|
|
foreach (var wmsin in WMSINBodyList)
|
|
|
|
|
{
|
|
|
|
|
wmsin.BSNO = BSNO;
|
|
|
|
|
wmsin.CONTRACTNO = CONTRACTNO;
|
|
|
|
|
wmsin.BLNO = BLNO;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var modb = new ModelObjectRepository();
|
|
|
|
|
DBResult result;
|
|
|
|
|
if (WMSINBodyList == null)
|
|
|
|
|
{
|
|
|
|
|
WMSINBodyList = new List<WMSNewIN>();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
result = modb.Save(head,
|
|
|
|
|
ModelObjectConvert<WMSNewIN>.ToModelObjectList(WMSINBodyList),
|
|
|
|
|
ModelObjectConvert<WMSNewIN>.ToModelObjectList(WMSINBodyDelList)
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
jsonRespose.Success = result.Success;
|
|
|
|
|
jsonRespose.Message = result.Message;
|
|
|
|
|
jsonRespose.Data = WMSNewDAL.GetData_LTJY(" GID='" + head.GID + "'", CookieConfig.GetCookie_UserId(Request), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]));
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//p_op_gain(head.BXGID);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public ContentResult GetWMSINList ( int start, int limit, string sort, string condition )
|
|
|
|
|
{
|
|
|
|
|
var dataList = WMSNewDAL.GetWMSINList(condition, sort);
|
|
|
|
|
|
|
|
|
|
var list = dataList.Skip(start).Take(limit);
|
|
|
|
|
|
|
|
|
|
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = list.ToList() });
|
|
|
|
|
return new ContentResult() { Content = json };
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 根据提单号和报关单号获取入库数据
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="BLNO"></param>
|
|
|
|
|
/// <param name="CUSTOMNO"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public ContentResult GetDataWithBLNOAndWMSNO ( string BLNO, string CUSTOMNO,string OPLBNAME )
|
|
|
|
|
{
|
|
|
|
|
bool hasExist = false;
|
|
|
|
|
var MutiBLNO = MsSysParamSetDAL.GetData("PARAMNAME='MutiBLNO'");
|
|
|
|
|
if (MutiBLNO.PARAMVALUE == "0")
|
|
|
|
|
hasExist = WMSNewDAL.CheckHasExistWMSInWBLNO(BLNO);
|
|
|
|
|
if (hasExist)
|
|
|
|
|
{
|
|
|
|
|
var json = JsonConvert.Serialize(new { Success = false, Message = "提单号" + BLNO + "下已存在入库单,无法再次新建入库单!" });
|
|
|
|
|
return new ContentResult() { Content = json };
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
int count = 1;
|
|
|
|
|
string sMBLNO = "";//提单号
|
|
|
|
|
string sMCUSTOMNO = "";//报关单号、备案清单号
|
|
|
|
|
string sCONTRACTNO = "";//合同号
|
|
|
|
|
string sCUSTNO = "";//委托编号
|
|
|
|
|
string sCUSTOMERNAME = "";//客户名称
|
|
|
|
|
string sBSNO = ""; //海运进口业务gid
|
|
|
|
|
string sCTNALL = "";//箱型
|
|
|
|
|
string sCNTRNO = "";//箱号
|
|
|
|
|
string sSEALNO = "";//封号
|
|
|
|
|
string sISBONDED = "";//是否保税业务
|
|
|
|
|
string sOPLBNAME = "";//是否保税业务
|
|
|
|
|
string sCompanyID = "";//货属分部(进口贸易)
|
|
|
|
|
int sPKGS = 0;
|
|
|
|
|
decimal sKGS = 0;
|
|
|
|
|
int sBAOGUANJIANSHU = 0;
|
|
|
|
|
var timeStamp = DateTime.Now.ToShortDateString();
|
|
|
|
|
string sStorageName = "";
|
|
|
|
|
WMSNewDAL.GetDataWithBLNOAndWMSNO(BLNO, CUSTOMNO,OPLBNAME, out sMBLNO, out sMCUSTOMNO, out sCONTRACTNO, out sCUSTNO, out sCUSTOMERNAME, out sBSNO, out sCTNALL, out sCNTRNO, out sBAOGUANJIANSHU, out sPKGS, out sKGS, out sSEALNO,out sISBONDED,out sOPLBNAME,out sCompanyID,out sStorageName);
|
|
|
|
|
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = count, CONTRACTNO = sCONTRACTNO, CUSTNO = sCUSTNO, CUSTOMERNAME = sCUSTOMERNAME, timeStamp = timeStamp, MBLNO = sMBLNO, MCUSTOMNO = sMCUSTOMNO, BSNO = sBSNO, CTNALL = sCTNALL, CNTRNO = sCNTRNO, BAOGUANJIANSHU = sBAOGUANJIANSHU, PKGS = sPKGS, KGS = sKGS, SEALNO = sSEALNO,ISBONDED = sISBONDED, OPLBNAME= sOPLBNAME,COMPANYID = sCompanyID,STORAGENAME = sStorageName });
|
|
|
|
|
return new ContentResult() { Content = json };
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public ContentResult GetDetailsForGoodsName ( string codegoodsid )
|
|
|
|
|
{
|
|
|
|
|
var dataList = WMSNewDAL.GetGoodsDetailsWithGid(codegoodsid);
|
|
|
|
|
|
|
|
|
|
var list = dataList.Skip(0).Take(1000);
|
|
|
|
|
|
|
|
|
|
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = list.ToList() });
|
|
|
|
|
return new ContentResult() { Content = json };
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 根据品牌名称和品名id查询件数
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="goodsDetailsName"></param>
|
|
|
|
|
/// <param name="codeGoodsId"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public ContentResult GetPKGWithGoodsDetailsNameAndCodeGoodsId ( string goodsDetailsName, string codeGoodsId )
|
|
|
|
|
{
|
|
|
|
|
string pkg = WMSNewDAL.GetPKGWithGoodsDetailsNameAndCodeGoodsId(goodsDetailsName,codeGoodsId);
|
|
|
|
|
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = 1, data = pkg });
|
|
|
|
|
return new ContentResult() { Content = json };
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 根据提单号和报关单号,获取报关单号列表
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="BLNO"></param>
|
|
|
|
|
/// <param name="CUSTOMNO"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public ContentResult GetCustomsNoListWithBLNOAndCustomNo (string BLNO, string CUSTOMNO )
|
|
|
|
|
{
|
|
|
|
|
var dataList = WMSNewDAL.GetCustomsNoListWithBLNOAndCustomNo(BLNO,CUSTOMNO);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = dataList.ToList() });
|
|
|
|
|
return new ContentResult() { Content = json };
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public ContentResult GetXMLMessageWithWMSNO (string WMSNO)
|
|
|
|
|
{
|
|
|
|
|
string USERID = CookieConfig.GetCookie_UserId(Request);
|
|
|
|
|
string message = "";
|
|
|
|
|
var ftpset = MsCodeFtpSetDAL.GetData("EDINAME='QCKCBW'", Convert.ToString(Session["COMPANYID"]));
|
|
|
|
|
string trade_code = ftpset.SENDCOMPANYCODE;
|
|
|
|
|
string unit = ftpset.SENDSUBCOMPANYCODE;
|
|
|
|
|
string ip = ftpset.SERVERIP;
|
|
|
|
|
string xml = MSGDAL_HCHX_DATA.GetXMLMessageWithWMSNO(WMSNO, USERID, trade_code, unit,ip, out message);
|
|
|
|
|
var json = JsonConvert.Serialize(new { Success = message == "", Message = message ==""? "发送成功" : "发送失败,下列字段为空:"+message, totalCount = 1, data = xml });
|
|
|
|
|
return new ContentResult() { Content = json };
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 发送报文
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="WMSBSNO"></param>
|
|
|
|
|
/// <param name="type"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public ContentResult GetXMLMessage4001WithWMSBSNO ( string WMSBSNO,int type )
|
|
|
|
|
{
|
|
|
|
|
string USERID = CookieConfig.GetCookie_UserId(Request);
|
|
|
|
|
string message = "";
|
|
|
|
|
var ftpset= MsCodeFtpSetDAL.GetData("EDINAME='CKRKBW'", Convert.ToString(Session["COMPANYID"]));
|
|
|
|
|
string trade_code = ftpset.SENDCOMPANYCODE;
|
|
|
|
|
string unit = ftpset.SENDSUBCOMPANYCODE;
|
|
|
|
|
string ip = ftpset.SERVERIP;
|
|
|
|
|
string xml = MSGDAL_HCHX_DATA2.GetXMLMessageWithWMSBSNO(WMSBSNO,USERID,out message,trade_code,unit,ip,type);
|
|
|
|
|
var json = JsonConvert.Serialize(new { Success = message=="", Message = message == "" ? "发送成功" : "发送失败,下列字段为空:" + message, totalCount = 1, data = xml });
|
|
|
|
|
return new ContentResult() { Content = json };
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public ContentResult LockWMS (string wmsno,bool EIP,int type) {
|
|
|
|
|
string message = "";
|
|
|
|
|
bool rst = WMSNewDAL.LockWMS(wmsno,EIP, type, out message);
|
|
|
|
|
var json = JsonConvert.Serialize(new { Success = rst, Message = message, totalCount = 1 });
|
|
|
|
|
return new ContentResult() { Content = json };
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public ContentResult LockWMS2 ( string wmsno, int type )
|
|
|
|
|
{
|
|
|
|
|
bool rst = WMSNewDAL.LockWMS2(wmsno, type);
|
|
|
|
|
var json = JsonConvert.Serialize(new { Success = rst, Message = rst ? "操作成功" : "操作失败", totalCount = 1 });
|
|
|
|
|
return new ContentResult() { Content = json };
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public ContentResult GetCodeCtnList ( string mblno )
|
|
|
|
|
{
|
|
|
|
|
int count = 0;
|
|
|
|
|
var dataList = WMSNewDAL.GetCodeCtnList(mblno);
|
|
|
|
|
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = count, data = dataList.ToList() });
|
|
|
|
|
return new ContentResult() { Content = json };
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public ContentResult GetCNTRNOList ( string mblno, string ctnall )
|
|
|
|
|
{
|
|
|
|
|
int count = 0;
|
|
|
|
|
var dataList = WMSNewDAL.GetCNTRNOList(mblno,ctnall);
|
|
|
|
|
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = count, data = dataList.ToList() });
|
|
|
|
|
return new ContentResult() { Content = json };
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 根据提单号,箱号 获取封号
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="bsno"></param>
|
|
|
|
|
/// <param name="cntrno"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public ContentResult GetSEALNOWithBLNOAndCNTRNO ( string bsno, string cntrno )
|
|
|
|
|
{
|
|
|
|
|
int pkgs = 0;
|
|
|
|
|
float cbm = 0.00f;
|
|
|
|
|
string SEALNO = WMSNewDAL.GetSEALNOWithBLNOAndCNTRNO(bsno, cntrno,out pkgs,out cbm);
|
|
|
|
|
bool flag = true;
|
|
|
|
|
if (SEALNO == "" && pkgs == 0 && cbm == 0.00f)
|
|
|
|
|
flag = false;
|
|
|
|
|
var json = JsonConvert.Serialize(new { Success = flag, Message = "查询成功", totalCount = 1, data = SEALNO,pkgs=pkgs,cbm=cbm });
|
|
|
|
|
return new ContentResult() { Content = json };
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public ContentResult GetGoodsInfoWithName ( string goodsname,string CodeAndName)
|
|
|
|
|
{
|
|
|
|
|
string codeAndname = "";
|
|
|
|
|
string gid = WMSNewDAL.GetGoodsInfoWithName(goodsname, out codeAndname);
|
|
|
|
|
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = 1, data=gid,CodeAndName=codeAndname });
|
|
|
|
|
return new ContentResult() { Content = json };
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public ContentResult GetZhuangXieGongList ()
|
|
|
|
|
{
|
|
|
|
|
List<Stevedores> zxglist = WMSNewDAL.GetZhuangXieGongList();
|
|
|
|
|
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = 999, data = zxglist });
|
|
|
|
|
return new ContentResult() { Content = json };
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public ContentResult GetCheDuiList ( )
|
|
|
|
|
{
|
|
|
|
|
List<CheDui> zxglist = WMSNewDAL.GetCheDuiList();
|
|
|
|
|
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = 999, data = zxglist });
|
|
|
|
|
return new ContentResult() { Content = json };
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public ContentResult CreateCost(string wmsno)
|
|
|
|
|
{
|
|
|
|
|
string msg = "";
|
|
|
|
|
string userid = Session["USERID"]==null?"":Session["USERID"].ToString();
|
|
|
|
|
bool rst= WMSNewDAL.CreateCost(wmsno,userid, out msg);
|
|
|
|
|
var json = JsonConvert.Serialize(new { Success = rst, Message =msg, totalCount = 1 });
|
|
|
|
|
return new ContentResult() { Content = json };
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#region 仓储费费率相关
|
|
|
|
|
public ContentResult SaveRate ( string BSNONAME, string BSNO, string WMSRATEBody, string WMSRATEBodyDel )
|
|
|
|
|
{
|
|
|
|
|
var WMSRATEBodyList = JsonConvert.Deserialize<List<WMSRATEmb>>(WMSRATEBody);
|
|
|
|
|
var WMSRATEDelBodyList = JsonConvert.Deserialize<List<WMSRATEmb>>(WMSRATEBodyDel);
|
|
|
|
|
|
|
|
|
|
if (WMSRATEBodyList != null)
|
|
|
|
|
{
|
|
|
|
|
foreach (var _WR in WMSRATEBodyList)
|
|
|
|
|
{
|
|
|
|
|
_WR.MODIFIEDUSER = CookieConfig.GetCookie_UserName(Request);
|
|
|
|
|
_WR.MODIFIEDTIME = DateTime.Now.ToString();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var modb = new ModelObjectRepository();
|
|
|
|
|
DBResult result = modb.SaveComm(BSNONAME, BSNO,
|
|
|
|
|
ModelObjectConvert<WMSRATEmb>.ToModelObjectList(WMSRATEBodyList),
|
|
|
|
|
ModelObjectConvert<WMSRATEmb>.ToModelObjectList(WMSRATEDelBodyList)
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
//刷新父窗口上的父节点
|
|
|
|
|
var jsonRespose = new JsonResponse
|
|
|
|
|
{
|
|
|
|
|
Success = result.Success,
|
|
|
|
|
Message = result.Message,
|
|
|
|
|
//Data = XXHDAL.GetData("M.ContractNo='" + head.ContractNo + "'")
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public ContentResult DelRate ( string BSNONAME, string BSNO, string WMSRATEBodyDel )
|
|
|
|
|
{
|
|
|
|
|
//var WMSRATEBodyList = JsonConvert.Deserialize<List<WMSRATEmb>>(WMSRATEBody);
|
|
|
|
|
var WMSRATEDelBodyList = JsonConvert.Deserialize<List<WMSRATEmb>>(WMSRATEBodyDel);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var modb = new ModelObjectRepository();
|
|
|
|
|
DBResult result = modb.SaveComm(BSNONAME, BSNO,
|
|
|
|
|
null,
|
|
|
|
|
ModelObjectConvert<WMSRATEmb>.ToModelObjectList(WMSRATEDelBodyList)
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
//刷新父窗口上的父节点
|
|
|
|
|
var jsonRespose = new JsonResponse
|
|
|
|
|
{
|
|
|
|
|
Success = result.Success,
|
|
|
|
|
Message = result.Message,
|
|
|
|
|
//Data = XXHDAL.GetData("M.ContractNo='" + head.ContractNo + "'")
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public ContentResult GetWMSRATE ( int start, int limit, string sort, string condition )
|
|
|
|
|
{
|
|
|
|
|
var dataList = WMSNewDAL.GetWMSRATE(condition, sort);
|
|
|
|
|
|
|
|
|
|
var list = dataList.Skip(start).Take(limit);
|
|
|
|
|
|
|
|
|
|
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = list.ToList() });
|
|
|
|
|
return new ContentResult() { Content = json };
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
public ContentResult GetSysFeeConfig ( string userid )
|
|
|
|
|
{
|
|
|
|
|
var value = WMSNewDAL.GetSysFeeConfig("");
|
|
|
|
|
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount =1, data = value.ToString() });
|
|
|
|
|
return new ContentResult() { Content = json };
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public ContentResult GetImportFeeModel ( string custname,string goodnameid,string wmsdate,string storagename)
|
|
|
|
|
{
|
|
|
|
|
var list = WMSNewDAL.GetImportFeeModel(custname, goodnameid,wmsdate,storagename);
|
|
|
|
|
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = list.Count, data = list });
|
|
|
|
|
return new ContentResult() { Content = json };
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public ContentResult GetLoaderFeeModel(string custname, string goodnameid, string wmsdate,string feetype,string storagename)
|
|
|
|
|
{
|
|
|
|
|
var list = WMSNewDAL.GetLoaderFeeModel(custname, goodnameid, wmsdate,feetype,storagename);
|
|
|
|
|
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = list.Count, data = list });
|
|
|
|
|
return new ContentResult() { Content = json };
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public ContentResult GetZhuangXieFeiWithZhuangXieGongID ( string gid)
|
|
|
|
|
{
|
|
|
|
|
int count = 0;
|
|
|
|
|
float feejian = 0;
|
|
|
|
|
float feeton = 0;
|
|
|
|
|
WMSNewDAL.GetZhuangXieFeiWithZhuangXieGongID(gid,out feejian,out feeton);
|
|
|
|
|
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = count, data1 = feejian,data2 =feeton });
|
|
|
|
|
return new ContentResult() { Content = json };
|
|
|
|
|
}
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 导入
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public ContentResult FileUpload()
|
|
|
|
|
{
|
|
|
|
|
var jsonRespose = JsonConvert.Serialize(new { success = false, message = "未上传文件" });
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
var file = Request.Files["file"];//获取文件
|
|
|
|
|
if (file == null)//未上传文件
|
|
|
|
|
return new ContentResult { Content = jsonRespose };
|
|
|
|
|
var path = Server.MapPath("../../UploadFiles/CtnTkDetail");//获取物理路径
|
|
|
|
|
if (!Directory.Exists(path))
|
|
|
|
|
Directory.CreateDirectory(path);
|
|
|
|
|
var name = Path.GetFileName(file.FileName);
|
|
|
|
|
var usercode = CookieConfig.GetCookie_UserCode(Request);
|
|
|
|
|
string filepath = path + "\\" + usercode + DateTime.Now.ToString("yyyyMMddHHmmssfff") + name;
|
|
|
|
|
if (System.IO.File.Exists(filepath))
|
|
|
|
|
System.IO.File.Delete(filepath);
|
|
|
|
|
file.SaveAs(filepath);
|
|
|
|
|
DataSet ds = GetExcelDs(filepath);
|
|
|
|
|
if (ds.Tables.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
DataTable dt = ds.Tables[0];
|
|
|
|
|
//修改导入的列名为字段名
|
|
|
|
|
string[] arr =
|
|
|
|
|
{
|
|
|
|
|
"GOODSNAMEID", "JIANSHU1", "PICIHAO", "TRUCKNO", "AREANAME"
|
|
|
|
|
};
|
|
|
|
|
for (int i = 0; i < arr.Length; i++)
|
|
|
|
|
dt.Columns[i].ColumnName = arr[i];
|
|
|
|
|
//增加显示品名
|
|
|
|
|
dt.Columns.Add(new DataColumn() { ColumnName = "GOODSNAMEDISPLAY" });
|
|
|
|
|
dt.Columns.Add(new DataColumn() { ColumnName = "GOODSNAME" });
|
|
|
|
|
dt.Columns.Add(new DataColumn() { ColumnName = "GID" });
|
|
|
|
|
dt.Columns.Add(new DataColumn() { ColumnName = "ZHONGLIANG2" });
|
|
|
|
|
foreach (DataRow item in dt.Rows)
|
|
|
|
|
{
|
|
|
|
|
item["GID"] = Guid.NewGuid().ToString();
|
|
|
|
|
item["ZHONGLIANG2"] = "0";
|
|
|
|
|
var model = BasicDataRefDAL.GetCodeGoodsList(string.Format("GOODCODE = '{0}' or GOODNAME like '%{0}%'", item["GOODSNAMEID"])).FirstOrDefault();
|
|
|
|
|
if (model != null)
|
|
|
|
|
{
|
|
|
|
|
item["GOODSNAMEID"] = model.GID;
|
|
|
|
|
item["GOODSNAMEDISPLAY"] = model.CodeAndName;
|
|
|
|
|
item["GOODSNAME"] = model.GOODNAME;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var list = ToJson(dt);
|
|
|
|
|
jsonRespose = JsonConvert.Serialize(new
|
|
|
|
|
{
|
|
|
|
|
success = true,
|
|
|
|
|
data = list,
|
|
|
|
|
totalCount = dt.Rows.Count,
|
|
|
|
|
message = "导入成功"
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
return new ContentResult { Content = jsonRespose };
|
|
|
|
|
}
|
|
|
|
|
catch (Exception se)
|
|
|
|
|
{
|
|
|
|
|
jsonRespose = JsonConvert.Serialize(new
|
|
|
|
|
{
|
|
|
|
|
success = false,
|
|
|
|
|
message = se.Message
|
|
|
|
|
});
|
|
|
|
|
return new ContentResult { Content = jsonRespose };
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 获取DataSet
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="filepath"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public DataSet GetExcelDs(string filepath)
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
var strConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + filepath + ";Extended Properties=Excel 8.0;HDR=Yes;IMEX=1";
|
|
|
|
|
if (filepath.ToLower().IndexOf(".xlsx", StringComparison.Ordinal) > 0)
|
|
|
|
|
strConn = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + filepath + ";Extended Properties=\"Excel 12.0 Xml;HDR=Yes\"";
|
|
|
|
|
OleDbConnection conn = new OleDbConnection(strConn);
|
|
|
|
|
conn.Open();
|
|
|
|
|
DataTable dt = conn.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, new object[] { null, null, null, "TABLE" });
|
|
|
|
|
conn.Close();
|
|
|
|
|
if (dt != null)
|
|
|
|
|
{
|
|
|
|
|
OleDbDataAdapter oada = new OleDbDataAdapter("select * from [" + dt.Rows[0][2] + "]", strConn);
|
|
|
|
|
DataSet ds = new DataSet();
|
|
|
|
|
oada.Fill(ds);
|
|
|
|
|
return ds;
|
|
|
|
|
}
|
|
|
|
|
return new DataSet();
|
|
|
|
|
}
|
|
|
|
|
catch (Exception)
|
|
|
|
|
{
|
|
|
|
|
return new DataSet();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// DataTable 对象 转换为Json 字符串
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="dt"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public static string ToJson(DataTable dt)
|
|
|
|
|
{
|
|
|
|
|
JavaScriptSerializer javaScriptSerializer = new JavaScriptSerializer();
|
|
|
|
|
javaScriptSerializer.MaxJsonLength = Int32.MaxValue; //取得最大数值
|
|
|
|
|
ArrayList arrayList = new ArrayList();
|
|
|
|
|
foreach (DataRow dataRow in dt.Rows)
|
|
|
|
|
{
|
|
|
|
|
Dictionary<string, object> dictionary = new Dictionary<string, object>();//实例化一个参数集合
|
|
|
|
|
foreach (DataColumn dataColumn in dt.Columns)
|
|
|
|
|
{
|
|
|
|
|
if (dataColumn.ColumnName == "OPERTIME")
|
|
|
|
|
dataRow[dataColumn.ColumnName] = DateTime.Now.ToString();
|
|
|
|
|
dictionary.Add(dataColumn.ColumnName, dataRow[dataColumn.ColumnName].ToString());
|
|
|
|
|
}
|
|
|
|
|
arrayList.Add(dictionary); //ArrayList集合中添加键值
|
|
|
|
|
}
|
|
|
|
|
return javaScriptSerializer.Serialize(arrayList);//返回一个json字符串
|
|
|
|
|
}
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 盘点校对
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public JsonResult PanDian(string code,string num,string gid)
|
|
|
|
|
{
|
|
|
|
|
string sql1 = string.Format("select [JIANSHU2] from [wms_in] where ASSOCIATEDNO='{0}' and goodsnameid=(select GID FROM code_goods WHERE GOODNO = '{1}')", gid, code);
|
|
|
|
|
var obj = SoftMng.DBUtility.DbHelperSQL.GetObject(sql1);
|
|
|
|
|
if (!String.IsNullOrEmpty(obj.ToString()))
|
|
|
|
|
num = (Convert.ToInt32(num) + Convert.ToInt32(obj)).ToString();
|
|
|
|
|
string sql =string.Format("UPDATE [wms_in] SET [JIANSHU2] ='{0}' where ASSOCIATEDNO='{1}' and goodsnameid=(select GID FROM code_goods WHERE GOODNO = '{2}')", num, gid,code);
|
|
|
|
|
var result = SoftMng.DBUtility.DbHelperSQL.ExecuteSql(sql)>0;
|
|
|
|
|
return Json(result);
|
|
|
|
|
}
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 获取商品名称
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public JsonResult beforePanDian(string code, string gid)
|
|
|
|
|
{
|
|
|
|
|
string sql = string.Format("select GOODSNAME,GOODSMODEL from [wms_in] where ASSOCIATEDNO='{0}' and goodsnameid=(select GID FROM code_goods WHERE GOODNO = '{1}')", gid, code);
|
|
|
|
|
var ds = SoftMng.DBUtility.DbHelperSQL.Query(sql);
|
|
|
|
|
if (ds.Tables.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
if (ds.Tables[0].Rows.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
var dataRow = ds.Tables[0].Rows[0];
|
|
|
|
|
return Json(new { res = true, name = dataRow["GOODSNAME"].ToString(), model = dataRow["GOODSMODEL"].ToString() });
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return Json(new { res = false });
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 从v_op_wmsbs当中取出现过的optype
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="condition"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
/// ContentResult GetDataList ( int start, int limit, string sort, string condition )
|
|
|
|
|
public ContentResult GetWMSOPTYPE(int start, int limit, string sort, string condition)
|
|
|
|
|
{
|
|
|
|
|
//corpid
|
|
|
|
|
|
|
|
|
|
var evList = BasicDataRefDAL.GeneralSelect(" select distinct oplbname GID,oplbname GVALUE from v_op_wmsbs ");
|
|
|
|
|
|
|
|
|
|
jsonresponse _jr = new jsonresponse();
|
|
|
|
|
|
|
|
|
|
if (evList.Count == 0)
|
|
|
|
|
{
|
|
|
|
|
_jr .success = false ;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
_jr.success = true;
|
|
|
|
|
_jr.data = evList.ToList() ;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return _jr.getContentReult();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|