伺服器端批號分攤

2021-07-02 03:28:47 字數 4177 閱讀 9206

//批號分攤

function batchshare(billno,billcode,ruleid,dbtype) else if(doclx == "b") else if(doclx == "c") else if(doclx == "d") else

var arr_fld = fldlist.split(",");

var retstr = "";

for(var i = 0; i < arr_fld.length; i++)

else

}else if(retlx == 1)else else }}

if (retlx == 0 || retlx == 2)

}function _reggoodsoccu(billno,billsn,billcode,ruleid,dsoccu,row)

//服務於客開時,全部攔截負庫存時,可在分攤完以後呼叫該函式進行負庫存攔截

function _chkbal() else

var chkret = dbutil.uniquevalue(fkclj);

if(! utility.isspace(chkret)) }/*

//批號分攤規則,批號資訊檢索排序使用。

hz 貨主,使用hz desc時,優先貨主為本機構

placenum 可開數量

xq 批號有效期

*/var ftgz = "order by hz desc,placenum desc";

var sqlnotes = "";

sqlnotes += " select 0 as ftnum,'n' as ftwc,"+_copynotesdt("a.","","a",0,0)+""

sqlnotes += " ,d.whname,c.goodscode,c.goodsname,d.iscontrol"

sqlnotes += " ,b.ruleid,'' as batchcode,'' as producedate,'' as valdate,'' as sterilcode,'' as sysdates"

sqlnotes += " from ecnotesdt a"

sqlnotes += " join ecnotesmt b on a.billno = b.billno and a.entid = b.entid"

sqlnotes += " join goodsdoc c on a.goodsid = c.goodsid and a.entid = c.entid"

sqlnotes += " join storehouse d on a.whid = d.whid and a.entid = d.entid"

sqlnotes += " where a.billno = "+billno;

var dsnotes = dbutil.opendataset(sqlnotes, {});

if(dsnotes.recordcount == 0) else

if(dsnotes.getvalueat(i, "iscontrol").equals("n"))

var regsql = ;//臨時占用記錄

//當前行分攤完成,跳轉下一行

if (parsefloat(dsnotes.getvalueat(i,"basenum")) - parsefloat(dsnotes.getvalueat(i,"ftnum")) <= 0

|| dsnotes.getvalueat(i, "ftwc").equals("y"))

var anglebal = "";

anglebal +=" select a.goodsid,a.angleid,a.locatid,b.whid,a.ownerid";

if(dbtype.equals("oracle")) else

anglebal +=" ,case when a.ownerid = d.orgid then 2 else 1 end as hz,e.valdate as xq";

anglebal +=" from anglebalance a";

anglebal +=" join storeroom b on a.locatid = b.locatid and a.entid = b.entid";

anglebal +=" join storehouse d on b.whid = d.whid and b.entid = d.entid";

anglebal +=" join goodsdoc c on a.goodsid = c.goodsid and a.entid = c.entid";

anglebal +=" left join batchcode e on a.angleid = e.angleid and a.goodsid = e.goodsid and a.entid = e.entid"

anglebal +=" left join(";

anglebal +=" select entid,ownerid,goodsid,angleid,locatid,sum(basenum) as basenum ";

anglebal +=" from goodsoccu";

anglebal +=" group by entid,ownerid,goodsid,angleid,locatid";

anglebal +=" ) x on a.angleid = x.angleid and a.goodsid = x.goodsid and a.locatid = x.locatid";

anglebal +=" and a.ownerid = x.ownerid and a.entid = x.entid";

anglebal +=" where a.salesstate=0"

anglebal +=" and a.goodsid = '"+dsnotes.getvalueat(i,"goodsid")+"'";

anglebal +=" and b.whid = '"+dsnotes.getvalueat(i,"whid")+"'";

anglebal +=" and a.entid = '"+dsnotes.getvalueat(i,"entid")+"'";

if(dbtype.equals("oracle")) else

anglebal +=" "+ftgz;

var dsanglebal = dbutil.opendataset(anglebal, {});//檢索該庫房品種的可分攤批號結存

if(dsanglebal.recordcount == 0) else

for(var j = 0;j < dsanglebal.recordcount;j++) else if (ballastnum < alastnum)

}}else else if (ballastnum < alastnum) }}

//anglebalance中的資料已分攤完成。

if(ballastnum <= 0)

}//庫存不足校驗

if(alastnum > 0)

//插入臨時占用記錄,防止乙個品種、庫房的多條記錄分攤多次

dbutil.batchupdate(regsql);}}

}var sqllist = ;

sqllist[sqllist.length] = "delete from ecnotesdt where billno = "

+dsnotes.field("billno").value+" and entid = '"

+dsnotes.field("entid").value+"'";

//處理資料

var isbatch = false;

for(var i = 0; i < dsnotes.recordcount;i++) else

}//刪除本單臨時占用記錄regsql

dbutil.batchupdate("delete from goodsoccu where billcode = '批號分攤占用'");

//重新插入資料

//批號建立   明細中存在不同庫房時可考慮該建立方法放在明細迴圈中

if(isbatch)

for(var i = 0; i < dsnotes.recordcount;i++)

}dbutil.batchupdate(sqllist);

//負庫存攔截 客開可考慮使用

//_chkbal();

}

socket伺服器端

伺服器 include winsock2.h include string.h include stdio.h include time.h include stdarg.h include stdlib.h pragma comment lib,ws2 32 void errexit const ...

kerberos伺服器端

1.安裝tcl wget tar zvxf tcl8.5.12 src.tar.gz cd tcl8.5.12 cd unix configure make make install 3.解壓 tar xvf krb5 1.10.3 signed.tar tar zvxf krb5 1.10.3.t...

C tcp伺服器端

伺服器端 include stdafx.h include winsock2.h pragma comment lib,ws2 32.lib include using namespace std int tmain int argc,char ar 建立套接字 sserver socket af ...